mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
Show indicatio if filter is set
This commit is contained in:
@@ -263,6 +263,18 @@
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.btn-filter-active {
|
||||
background-color: #ffc107 !important;
|
||||
border-color: #ffc107 !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
.btn-filter-active:hover {
|
||||
background-color: #e0a800 !important;
|
||||
border-color: #e0a800 !important;
|
||||
}
|
||||
.btn-filter-active .fas {
|
||||
color: #000 !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
$options = json_decode($options);
|
||||
|
||||
@@ -1592,6 +1592,7 @@ $(document).ready(function () {
|
||||
} else {
|
||||
$("#"+type).val(col1);
|
||||
}
|
||||
updateFilterButtonStates();
|
||||
$('#searchForm').submit();
|
||||
});
|
||||
}
|
||||
@@ -1663,17 +1664,56 @@ $(document).ready(function () {
|
||||
silentReset = false; // reset flag
|
||||
return; // skip submit
|
||||
}
|
||||
requestAnimationFrame(function() {
|
||||
updateFilterButtonStates();
|
||||
});
|
||||
setTimeout(function() {
|
||||
$('#searchForm').submit();
|
||||
});
|
||||
});
|
||||
|
||||
$('#searchForm').on('change', 'input, select', function() {
|
||||
updateFilterButtonStates();
|
||||
});
|
||||
|
||||
rebind_checkbox_trigger();
|
||||
|
||||
$('#searchForm').submit();
|
||||
|
||||
setTimeout(function() {
|
||||
updateFilterButtonStates();
|
||||
}, 100);
|
||||
|
||||
});
|
||||
|
||||
function hasActiveFilters() {
|
||||
const textFilters = ['#dx', '#state', '#gridsquare', '#county', '#dok', '#sota', '#pota', '#wwff', '#operator', '#contest', '#comment', '#qslvia', '#distance', '#duration'];
|
||||
const dateFilters = ['#dateFrom', '#dateTo'];
|
||||
const selectFilters = ['#dxcc', '#mode', '#band', '#sats', '#orbits', '#propmode', '#cqzone', '#ituzone', '#iota', '#continent', '#qslSent', '#qslReceived', '#qslSentMethod', '#qslReceivedMethod', '#lotwSent', '#lotwReceived', '#clublogSent', '#clublogReceived', '#eqslSent', '#eqslReceived', '#dclSent', '#dclReceived', '#qrzSent', '#qrzReceived', '#qslimages'];
|
||||
const hiddenFilters = ['#dupes', '#invalid', '#dupedate', '#dupemode', '#dupeband', '#dupesat'];
|
||||
const allFilters = [...textFilters, ...dateFilters, ...selectFilters, ...hiddenFilters];
|
||||
|
||||
return allFilters.some(selector => {
|
||||
const $el = $(selector);
|
||||
if (!$el.length) return false;
|
||||
const val = $el.val();
|
||||
if (Array.isArray(val)) {
|
||||
return false;
|
||||
}
|
||||
return val && val !== '*' && val !== '' && val !== 'All';
|
||||
});
|
||||
}
|
||||
|
||||
function updateFilterButtonStates() {
|
||||
const hasActive = hasActiveFilters();
|
||||
|
||||
if (hasActive) {
|
||||
$('#filterDropdown').addClass('btn-filter-active');
|
||||
} else {
|
||||
$('#filterDropdown').removeClass('btn-filter-active');
|
||||
}
|
||||
}
|
||||
|
||||
function rebind_checkbox_trigger() {
|
||||
$('#checkBoxAll').change(function (event) {
|
||||
if (this.checked) {
|
||||
@@ -1960,6 +2000,7 @@ function saveOptions() {
|
||||
dateTo.value = '';
|
||||
break;
|
||||
}
|
||||
updateFilterButtonStates();
|
||||
}
|
||||
|
||||
// Reset dates function
|
||||
@@ -1968,6 +2009,7 @@ function saveOptions() {
|
||||
const dateTo = document.getElementById('dateTo');
|
||||
dateFrom.value = '';
|
||||
dateTo.value = '';
|
||||
updateFilterButtonStates();
|
||||
}
|
||||
|
||||
function checkUpdateDistances() {
|
||||
|
||||
Reference in New Issue
Block a user