добавил при выборе тура отключение галочки Завершенные матчи
This commit is contained in:
10
app.py
10
app.py
@@ -602,9 +602,15 @@ def admin_matches(
|
|||||||
request: Request,
|
request: Request,
|
||||||
today_only: bool = Query(default=False),
|
today_only: bool = Query(default=False),
|
||||||
tour: str | None = Query(default=None),
|
tour: str | None = Query(default=None),
|
||||||
hide_finished: str = Query(default="true"),
|
hide_finished: str | None = Query(default=None),
|
||||||
):
|
):
|
||||||
hide_finished_bool = str(hide_finished).lower() == "true"
|
# По умолчанию завершённые матчи скрываем.
|
||||||
|
# Но если оператор выбрал конкретный тур, показываем все матчи тура,
|
||||||
|
# поэтому чекбокс «Завершенные матчи» автоматически снимается.
|
||||||
|
if hide_finished is None:
|
||||||
|
hide_finished_bool = False if tour else True
|
||||||
|
else:
|
||||||
|
hide_finished_bool = str(hide_finished).lower() == "true"
|
||||||
|
|
||||||
matches = list_matches_for_admin(
|
matches = list_matches_for_admin(
|
||||||
today_only=today_only,
|
today_only=today_only,
|
||||||
|
|||||||
@@ -408,7 +408,7 @@
|
|||||||
<select
|
<select
|
||||||
name="tour"
|
name="tour"
|
||||||
id="tour"
|
id="tour"
|
||||||
onchange="document.getElementById('filters-form').submit();"
|
onchange="submitFiltersAfterTourChange();"
|
||||||
>
|
>
|
||||||
<option value="">Все туры</option>
|
<option value="">Все туры</option>
|
||||||
{% for t in tours %}
|
{% for t in tours %}
|
||||||
@@ -424,6 +424,7 @@
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="hide_finished"
|
name="hide_finished"
|
||||||
|
id="hideFinishedCheckbox"
|
||||||
value="true"
|
value="true"
|
||||||
{% if hide_finished %}checked{% endif %}
|
{% if hide_finished %}checked{% endif %}
|
||||||
onchange="document.getElementById('filters-form').submit();"
|
onchange="document.getElementById('filters-form').submit();"
|
||||||
@@ -486,6 +487,23 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
function submitFiltersAfterTourChange() {
|
||||||
|
const form = document.getElementById("filters-form");
|
||||||
|
const tourSelect = document.getElementById("tour");
|
||||||
|
const hideFinishedCheckbox = document.getElementById("hideFinishedCheckbox");
|
||||||
|
|
||||||
|
if (tourSelect && hideFinishedCheckbox) {
|
||||||
|
// Выбран конкретный тур — показываем в нём все матчи, включая завершённые.
|
||||||
|
// Выбраны «Все туры» — снова скрываем завершённые матчи.
|
||||||
|
hideFinishedCheckbox.checked = !tourSelect.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form) {
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
|
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
|
||||||
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
|
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
|
||||||
<div class="matrix-content">
|
<div class="matrix-content">
|
||||||
|
|||||||
Reference in New Issue
Block a user