init commit
This commit is contained in:
86
lottery/templates/admin/add_participants.html
Normal file
86
lottery/templates/admin/add_participants.html
Normal file
@@ -0,0 +1,86 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block extrahead %}
|
||||
{{ block.super }}
|
||||
<style>
|
||||
.custom-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
const selectAllCheckbox = document.getElementById("select-all");
|
||||
if (selectAllCheckbox) {
|
||||
selectAllCheckbox.addEventListener("click", function(){
|
||||
const checkboxes = document.querySelectorAll("input[name='invoices']");
|
||||
checkboxes.forEach(chk => chk.checked = selectAllCheckbox.checked);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock extrahead %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<h1>Добавление участников лотереи: {{ lottery.name }}</h1>
|
||||
<p>{{ lottery.description }}</p>
|
||||
|
||||
<!-- Форма фильтрации -->
|
||||
<form method="get" class="form-inline mb-3">
|
||||
<input type="hidden" name="lottery_id" value="{{ lottery.id }}">
|
||||
<div class="form-group mr-3">
|
||||
<label for="id_deposit_min" class="mr-2">Минимальный депозит:</label>
|
||||
<input type="number" step="0.01" name="deposit_min" id="id_deposit_min" class="form-control">
|
||||
</div>
|
||||
<div class="form-group mr-3">
|
||||
<label for="id_deposit_max" class="mr-2">Максимальный депозит:</label>
|
||||
<input type="number" step="0.01" name="deposit_max" id="id_deposit_max" class="form-control">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-info">Фильтровать</button>
|
||||
</form>
|
||||
|
||||
<!-- Форма добавления участников -->
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for invoice in form.fields.invoices.queryset %}
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" name="invoices" value="{{ invoice.id }}" />
|
||||
</td>
|
||||
<td>{{ invoice.ext_id }}</td>
|
||||
<td>
|
||||
{% if invoice.client_name %}
|
||||
{{ invoice.client_name }}
|
||||
{% else %}
|
||||
Не указан
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ invoice.deposit_sum }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="5" 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>
|
||||
{% endblock content %}
|
||||
26
lottery/templates/admin/bindingrequests_change_list.html
Normal file
26
lottery/templates/admin/bindingrequests_change_list.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% extends "admin/change_list.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Список заявок на привязку (Всего: {{ total_requests }})</h2>
|
||||
{% if cl.result_list %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Клиентская карта</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for request in cl.result_list %}
|
||||
<tr>
|
||||
<td>{{ request.client_card }}</td>
|
||||
<td>{{ request.status }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>Нет заявок.</p>
|
||||
{% endif %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
12
lottery/templates/admin/clients_change_list.html
Normal file
12
lottery/templates/admin/clients_change_list.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "admin/change_list.html" %}
|
||||
|
||||
{% block object-tools %}
|
||||
<div class="object-tools">
|
||||
<ul class="grp-object-tools">
|
||||
<li>
|
||||
<a href="{% url 'admin:sync_clients' %}" class="btn btn-primary">Синхронизировать клиентов</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,22 @@
|
||||
{% extends "admin/change_list.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block object-tools-items %}
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<form id="lotterySelectForm" method="get" class="form-inline mr-3">
|
||||
<select name="lottery_id" id="lotterySelect" class="form-control mr-2">
|
||||
<option value="">{% trans "-- Выберите розыгрыш --" %}</option>
|
||||
{% for lottery in active_lotteries %}
|
||||
<option value="{{ lottery.id }}" {% if request.GET.lottery_id == lottery.id|stringformat:"s" %}selected{% endif %}>
|
||||
{{ lottery.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">{% trans "Выбрать" %}</button>
|
||||
</form>
|
||||
<a href="{% url 'admin:add_participants' %}?lottery_id={{ request.GET.lottery_id|default:'' }}" class="btn btn-success">
|
||||
{% trans "Добавить участников" %}
|
||||
</a>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
57
lottery/templates/admin/draw_result.html
Normal file
57
lottery/templates/admin/draw_result.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h1>Результаты розыгрыша</h1>
|
||||
<h2>Лотерея: {{ lottery.name }}</h2>
|
||||
<p>{{ lottery.description }}</p>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Призовое место</th>
|
||||
<th>Описание приза</th>
|
||||
<th>Награда</th>
|
||||
<th>Победитель (Счет)</th>
|
||||
<th>Дата розыгрыша</th>
|
||||
<th>Статус</th>
|
||||
<th>Действие</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for result in draw_results %}
|
||||
<tr>
|
||||
<td>{{ result.prize.prize_place }}</td>
|
||||
<td>{{ result.prize.description }}</td>
|
||||
<td>{{ result.prize.reward }}</td>
|
||||
<td>
|
||||
{% if result.participant %}
|
||||
{{ result.participant.invoice }}
|
||||
{% else %}
|
||||
Не выбран
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ result.drawn_at }}</td>
|
||||
<td>
|
||||
{% if result.confirmed %}
|
||||
Подтвержден
|
||||
{% else %}
|
||||
Не подтвержден
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if not result.confirmed %}
|
||||
<a class="button" href="{% url 'admin:confirm_draw_result' result.id %}">Подтвердить</a>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="button" href="{% url 'admin:draw_lottery_changelist' %}">Вернуться к списку лотерей</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
119
lottery/templates/admin/invoices_change_list.html
Normal file
119
lottery/templates/admin/invoices_change_list.html
Normal file
@@ -0,0 +1,119 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<h1>Счета</h1>
|
||||
|
||||
<!-- Кнопка синхронизации счетов -->
|
||||
<div class="mb-4">
|
||||
<a href="{% url 'admin:sync_invoices' %}" class="btn btn-success">Синхронизировать счета</a>
|
||||
</div>
|
||||
|
||||
<!-- Фильтры и кнопка обновления -->
|
||||
<div class="mb-4">
|
||||
<form id="filterForm" class="form-inline">
|
||||
<div class="form-group mr-3">
|
||||
<label for="startDate" class="mr-2">Начальная дата:</label>
|
||||
<input type="date" id="startDate" name="start_date" class="form-control">
|
||||
</div>
|
||||
<div class="form-group mr-3">
|
||||
<label for="endDate" class="mr-2">Конечная дата:</label>
|
||||
<input type="date" id="endDate" name="end_date" class="form-control">
|
||||
</div>
|
||||
<div class="form-group mr-3">
|
||||
<label for="clientSearch" class="mr-2">Клиент:</label>
|
||||
<input type="text" id="clientSearch" name="client_search" placeholder="Имя клиента" class="form-control">
|
||||
</div>
|
||||
<button type="button" id="refreshButton" class="btn btn-primary">Обновить</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Таблица счетов -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm" id="invoicesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Создан</th>
|
||||
<th>Закрыт</th>
|
||||
<th>Счет</th>
|
||||
<th>Клиент</th>
|
||||
<th>Номер клиента</th>
|
||||
<th>Сумма счета</th>
|
||||
<th>Бонус</th>
|
||||
<th>ФД</th>
|
||||
<th>Депозит</th>
|
||||
<th>Примечание</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Данные будут подгружаться AJAX-ом -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Подключение jQuery из админки -->
|
||||
<script src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>
|
||||
<script>
|
||||
function fetchInvoices() {
|
||||
var startDate = $('#startDate').val();
|
||||
var endDate = $('#endDate').val();
|
||||
var clientSearch = $('#clientSearch').val();
|
||||
$.ajax({
|
||||
url: '{% url "filtered_invoices" %}',
|
||||
method: 'GET',
|
||||
data: {
|
||||
start_date: startDate,
|
||||
end_date: endDate,
|
||||
client: clientSearch
|
||||
},
|
||||
success: function(response) {
|
||||
console.log("Response:", response); // Для отладки
|
||||
var invoices = response.member || [];
|
||||
var tbody = $('#invoicesTable tbody');
|
||||
tbody.empty();
|
||||
if (invoices.length === 0) {
|
||||
tbody.append('<tr><td colspan="14" class="text-center">Счета не найдены</td></tr>');
|
||||
} else {
|
||||
invoices.forEach(function(invoice) {
|
||||
var client = invoice.client || {};
|
||||
var row = '<tr>' +
|
||||
'<td>' + (invoice.created_at || '') + '</td>' +
|
||||
'<td>' + (invoice.closed_at || 'N/A') + '</td>' +
|
||||
'<td>' + (invoice.ext_id || '') + '</td>' +
|
||||
'<td>' + (client.name || '') + '</td>' +
|
||||
'<td>' + (client.club_card_num || '') + '</td>' +
|
||||
'<td>' + (invoice.sum || '') + '</td>' +
|
||||
'<td>' + (invoice.bonus || '') + '</td>' +
|
||||
'<td>' + (invoice.start_bonus || '') + '</td>' +
|
||||
'<td>' + (invoice.deposit_sum || '') + '</td>' +
|
||||
'<td>' + (invoice.notes || '') + '</td>' +
|
||||
'</tr>';
|
||||
tbody.append(row);
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
alert("Ошибка загрузки счетов: " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
// Загружаем счета при первой загрузке страницы
|
||||
fetchInvoices();
|
||||
|
||||
// Обновление по нажатию на кнопку "Обновить"
|
||||
$('#refreshButton').click(function(){
|
||||
fetchInvoices();
|
||||
});
|
||||
|
||||
// Фильтрация по поиску клиента (с задержкой можно добавить debounce, если требуется)
|
||||
$('#clientSearch').on('keyup', function(){
|
||||
fetchInvoices();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user