Переделки и улучшения
This commit is contained in:
@@ -118,6 +118,40 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Column visibility toggle button -->
|
||||
<div>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle"
|
||||
id="columnVisibilityDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-gear"></i> Колонки
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="columnVisibilityDropdown" style="max-height: 400px; overflow-y: auto;">
|
||||
<li>
|
||||
<label class="dropdown-item">
|
||||
<input type="checkbox" id="select-all-columns" onchange="toggleAllColumns(this)"> Выбрать всё
|
||||
</label>
|
||||
</li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="0" checked onchange="toggleColumn(this)"> Выбрать</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="1" checked onchange="toggleColumn(this)"> ID</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="2" checked onchange="toggleColumn(this)"> Имя</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="3" checked onchange="toggleColumn(this)"> Спутник</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="4" checked onchange="toggleColumn(this)"> Тип объекта</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="5" checked onchange="toggleColumn(this)"> Принадлежность объекта</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="6" checked onchange="toggleColumn(this)"> Координаты ГЛ</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="7" checked onchange="toggleColumn(this)"> Кол-во ГЛ(точек)</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="8" checked onchange="toggleColumn(this)"> Координаты Кубсата</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="9" checked onchange="toggleColumn(this)"> Координаты визуального наблюдения</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="10" checked onchange="toggleColumn(this)"> Координаты справочные</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="11" onchange="toggleColumn(this)"> Создано</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="12" onchange="toggleColumn(this)"> Обновлено</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="13" checked onchange="toggleColumn(this)"> Дата подтверждения</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="14" checked onchange="toggleColumn(this)"> Последний сигнал</label></li>
|
||||
<li><label class="dropdown-item"><input type="checkbox" class="column-toggle" data-column="15" checked onchange="toggleColumn(this)"> Действия</label></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<div class="ms-auto">
|
||||
{% include 'mainapp/components/_pagination.html' with page_obj=page_obj show_info=True %}
|
||||
@@ -281,32 +315,6 @@
|
||||
placeholder="До" value="{{ date_to|default:'' }}">
|
||||
</div>
|
||||
|
||||
<!-- Signal Mark Filter -->
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Наличие сигнала:</label>
|
||||
<div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="has_signal_mark" id="has_signal_mark_1"
|
||||
value="1" {% if has_signal_mark == '1' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="has_signal_mark_1">Есть</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="has_signal_mark" id="has_signal_mark_0"
|
||||
value="0" {% if has_signal_mark == '0' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="has_signal_mark_0">Нет</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mark Date Filter -->
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Дата отметки сигнала:</label>
|
||||
<input type="date" name="mark_date_from" id="mark_date_from" class="form-control form-control-sm mb-1"
|
||||
placeholder="От" value="{{ mark_date_from|default:'' }}">
|
||||
<input type="date" name="mark_date_to" id="mark_date_to" class="form-control form-control-sm"
|
||||
placeholder="До" value="{{ mark_date_to|default:'' }}">
|
||||
</div>
|
||||
|
||||
<hr class="my-3">
|
||||
<h6 class="text-muted mb-2"><i class="bi bi-sliders"></i> Фильтры по параметрам точек</h6>
|
||||
|
||||
@@ -444,13 +452,14 @@
|
||||
<th scope="col" style="min-width: 150px;">Координаты Кубсата</th>
|
||||
<th scope="col" style="min-width: 150px;">Координаты визуального наблюдения</th>
|
||||
<th scope="col" style="min-width: 150px;">Координаты справочные</th>
|
||||
<th scope="col" style="min-width: 180px;">Наличие сигнала</th>
|
||||
<th scope="col" style="min-width: 120px;">
|
||||
{% include 'mainapp/components/_sort_header.html' with field='created_at' label='Создано' current_sort=sort %}
|
||||
</th>
|
||||
<th scope="col" style="min-width: 120px;">
|
||||
{% include 'mainapp/components/_sort_header.html' with field='updated_at' label='Обновлено' current_sort=sort %}
|
||||
</th>
|
||||
<th scope="col" style="min-width: 150px;">Дата подтверждения</th>
|
||||
<th scope="col" style="min-width: 150px;">Последний сигнал</th>
|
||||
<th scope="col" class="text-center" style="min-width: 150px;">Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -489,32 +498,10 @@
|
||||
<td>{{ source.coords_kupsat }}</td>
|
||||
<td>{{ source.coords_valid }}</td>
|
||||
<td>{{ source.coords_reference }}</td>
|
||||
<td style="padding: 0.3rem; vertical-align: top;">
|
||||
{% if source.marks %}
|
||||
<div style="font-size: 0.75rem; line-height: 1.3;">
|
||||
{% for mark in source.marks %}
|
||||
<div style="{% if not forloop.last %}border-bottom: 1px solid #dee2e6; padding-bottom: 3px; margin-bottom: 3px;{% endif %}">
|
||||
<div style="margin-bottom: 1px;">
|
||||
{% if mark.mark %}
|
||||
<span class="badge bg-success" style="font-size: 0.7rem;">Есть</span>
|
||||
{% elif mark.mark == False %}
|
||||
<span class="badge bg-danger" style="font-size: 0.7rem;">Нет</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary" style="font-size: 0.7rem;">-</span>
|
||||
{% endif %}
|
||||
<span class="text-muted" style="font-size: 0.7rem;">{{ mark.timestamp|date:"d.m.y H:i" }}</span>
|
||||
</div>
|
||||
<div class="text-muted" style="font-size: 0.65rem;">{{ mark.created_by }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<span class="text-muted">-</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>{{ source.created_at|date:"d.m.Y H:i" }}</td>
|
||||
<td>{{ source.updated_at|date:"d.m.Y H:i" }}</td>
|
||||
<td>{{ source.confirm_at|date:"d.m.Y H:i"|default:"-" }}</td>
|
||||
<td>{{ source.last_signal_at|date:"d.m.Y H:i"|default:"-" }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group" role="group">
|
||||
{% if source.objitem_count > 0 %}
|
||||
@@ -566,7 +553,7 @@
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="14" class="text-center text-muted">Нет данных для отображения</td>
|
||||
<td colspan="15" class="text-center text-muted">Нет данных для отображения</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -1062,6 +1049,47 @@ function updateFilterCounter() {
|
||||
}
|
||||
}
|
||||
|
||||
// Column visibility functions
|
||||
function toggleColumn(checkbox) {
|
||||
const columnIndex = parseInt(checkbox.getAttribute('data-column'));
|
||||
const table = document.querySelector('.table');
|
||||
const cells = table.querySelectorAll(`td:nth-child(${columnIndex + 1}), th:nth-child(${columnIndex + 1})`);
|
||||
|
||||
if (checkbox.checked) {
|
||||
cells.forEach(cell => {
|
||||
cell.style.display = '';
|
||||
});
|
||||
} else {
|
||||
cells.forEach(cell => {
|
||||
cell.style.display = 'none';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAllColumns(selectAllCheckbox) {
|
||||
const columnCheckboxes = document.querySelectorAll('.column-toggle');
|
||||
columnCheckboxes.forEach(checkbox => {
|
||||
checkbox.checked = selectAllCheckbox.checked;
|
||||
toggleColumn(checkbox);
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize column visibility - hide Создано and Обновлено columns by default
|
||||
function initColumnVisibility() {
|
||||
const createdAtCheckbox = document.querySelector('input[data-column="11"]');
|
||||
const updatedAtCheckbox = document.querySelector('input[data-column="12"]');
|
||||
|
||||
if (createdAtCheckbox) {
|
||||
createdAtCheckbox.checked = false;
|
||||
toggleColumn(createdAtCheckbox);
|
||||
}
|
||||
|
||||
if (updatedAtCheckbox) {
|
||||
updatedAtCheckbox.checked = false;
|
||||
toggleColumn(updatedAtCheckbox);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Setup select-all checkbox
|
||||
@@ -1092,7 +1120,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
setupRadioLikeCheckboxes('has_coords_kupsat');
|
||||
setupRadioLikeCheckboxes('has_coords_valid');
|
||||
setupRadioLikeCheckboxes('has_coords_reference');
|
||||
setupRadioLikeCheckboxes('has_signal_mark');
|
||||
|
||||
// Update filter counter on page load
|
||||
updateFilterCounter();
|
||||
@@ -1122,6 +1149,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
if (offcanvasElement) {
|
||||
offcanvasElement.addEventListener('show.bs.offcanvas', updateFilterCounter);
|
||||
}
|
||||
|
||||
// Initialize column visibility
|
||||
setTimeout(initColumnVisibility, 100);
|
||||
});
|
||||
|
||||
// Show source details in modal
|
||||
|
||||
Reference in New Issue
Block a user