diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 3e3cca5e8..3db48f04c 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -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; + }
" method="post"> - - - - - - + + + + + +
@@ -314,19 +326,19 @@ $options = json_decode($options);
datetime->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - +
datetime->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - +
dx->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
dxcc->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> -
state->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
gridsquare->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
mode->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - $mode) { @@ -368,7 +380,7 @@ $options = json_decode($options);
band->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> -
propagation->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -422,7 +434,7 @@ $options = json_decode($options);
cqzone->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> -
ituzone->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> -
county->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
dok->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
sota->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
pota->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
iota->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> -
wwff->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
operator->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
contest->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
continent->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -507,21 +519,21 @@ $options = json_decode($options);
comment->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
distance->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
duration->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
- @@ -530,7 +542,7 @@ $options = json_decode($options);
- @@ -557,7 +569,7 @@ $options = json_decode($options);
qsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -568,7 +580,7 @@ $options = json_decode($options);
qsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -579,7 +591,7 @@ $options = json_decode($options);
qsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -589,7 +601,7 @@ $options = json_decode($options);
qsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -601,7 +613,7 @@ $options = json_decode($options);
lotw->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -612,7 +624,7 @@ $options = json_decode($options);
lotw->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -624,7 +636,7 @@ $options = json_decode($options);
clublog->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -635,7 +647,7 @@ $options = json_decode($options);
clublog->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -648,7 +660,7 @@ $options = json_decode($options);
eqsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -659,7 +671,7 @@ $options = json_decode($options);
eqsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -670,7 +682,7 @@ $options = json_decode($options);
dcl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -679,7 +691,7 @@ $options = json_decode($options);
dcl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -690,11 +702,11 @@ $options = json_decode($options);
qsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - "> + ">
qsl->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -702,7 +714,7 @@ $options = json_decode($options);
qrz->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - @@ -711,7 +723,7 @@ $options = json_decode($options);
qrz->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl"> - diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index e23d141fc..445333008 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -6,6 +6,7 @@ let inStateFixing = false; let stateFixStats = {fixed: 0, skipped: 0, fixedDxcc: new Set(), skippedDxcc: new Set(), skipReasons: new Set(), skippedDetails: []}; let lastChecked = null; let silentReset = false; +const filterDefaults = {}; document.addEventListener("DOMContentLoaded", function() { document.querySelectorAll('.dropdown').forEach(dd => { @@ -626,7 +627,22 @@ function unselectQsoID(qsoID) { $('#checkBoxAll').prop("checked", false); } +// Capture default values for all filter fields on page load +function captureFilterDefaults() { + $('.filter-field').each(function() { + const $el = $(this); + const id = $el.attr('id'); + const name = $el.attr('name'); + // Use id as key if available, otherwise use name + const key = id ? '#' + id : '[name="' + name + '"]'; + filterDefaults[key] = $el.val(); + }); +} + $(document).ready(function () { + // Capture default filter values BEFORE any other initialization + captureFilterDefaults(); + // initialize multiselect dropdown for locations // Documentation: https://davidstutz.github.io/bootstrap-multiselect/index.html @@ -1592,6 +1608,7 @@ $(document).ready(function () { } else { $("#"+type).val(col1); } + updateFilterButtonStates(); $('#searchForm').submit(); }); } @@ -1663,17 +1680,55 @@ $(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() { + return Object.keys(filterDefaults).some(selector => { + const $el = $(selector); + if (!$el.length) return false; + const currentVal = $el.val(); + const defaultVal = filterDefaults[selector]; + + // Handle arrays (multi-select) + if (Array.isArray(currentVal)) { + return false; // Multi-selects not currently used + } + + // Compare current value to stored default + return currentVal !== defaultVal; + }); +} + +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 +2015,7 @@ function saveOptions() { dateTo.value = ''; break; } + updateFilterButtonStates(); } // Reset dates function @@ -1968,6 +2024,7 @@ function saveOptions() { const dateTo = document.getElementById('dateTo'); dateFrom.value = ''; dateTo.value = ''; + updateFilterButtonStates(); } function checkUpdateDistances() {