mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Initial commit
This commit is contained in:
@@ -5,6 +5,46 @@
|
||||
var custom_date_format = "<?php echo $custom_date_format ?>";
|
||||
var popup_warning = "<?= __("Pop-up was blocked! Please allow pop-ups for this site permanently."); ?>";
|
||||
var lang_click_to_prepare_logging = "<?= __("Click to prepare logging."); ?>";
|
||||
|
||||
// Handle "All" option for multi-select dropdowns
|
||||
$(document).ready(function() {
|
||||
// Disable Apply Filters button initially
|
||||
$('#applyFiltersButton').prop('disabled', true);
|
||||
|
||||
// Function to enable Apply Filters button when changes are made
|
||||
function enableApplyButton() {
|
||||
$('#applyFiltersButton').prop('disabled', false);
|
||||
}
|
||||
|
||||
// Function to handle All option selection
|
||||
function handleAllOption(selectId) {
|
||||
$('#' + selectId).on('change', function() {
|
||||
let selected = $(this).val() || [];
|
||||
|
||||
// If "All" was just selected, deselect all others
|
||||
if (selected.includes('All') || selected.includes('Any')) {
|
||||
let allValue = selected.includes('All') ? 'All' : 'Any';
|
||||
if (selected.length > 1) {
|
||||
// All was just selected, keep only All
|
||||
$(this).val([allValue]);
|
||||
}
|
||||
} else if (selected.length === 0) {
|
||||
// Nothing selected, select All
|
||||
let allValue = selectId === 'decontSelect' ? 'Any' : 'All';
|
||||
$(this).val([allValue]);
|
||||
}
|
||||
|
||||
// Enable Apply Filters button
|
||||
enableApplyButton();
|
||||
});
|
||||
}
|
||||
|
||||
// Apply to all filter selects
|
||||
handleAllOption('cwnSelect');
|
||||
handleAllOption('decontSelect');
|
||||
handleAllOption('band');
|
||||
handleAllOption('mode');
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -39,6 +79,71 @@
|
||||
.dataTables_wrapper {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
/* Ensure table respects container width */
|
||||
.spottable {
|
||||
width: 100% !important;
|
||||
table-layout: auto;
|
||||
}
|
||||
|
||||
.dataTables_wrapper {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* Style for multi-select dropdowns */
|
||||
select[multiple] {
|
||||
height: auto !important;
|
||||
min-height: 300px;
|
||||
max-height: 600px;
|
||||
}
|
||||
|
||||
/* Make multi-select options look more interactive */
|
||||
select[multiple] option {
|
||||
padding: 8px 12px;
|
||||
border-radius: 3px;
|
||||
margin: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select[multiple] option:hover {
|
||||
background-color: #e9ecef !important;
|
||||
}
|
||||
|
||||
select[multiple] option:checked {
|
||||
background-color: #0d6efd !important;
|
||||
color: white !important;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Add visual checkmark indicator for selected options */
|
||||
select[multiple] option:checked::before {
|
||||
content: "✓ ";
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Responsive adjustments for filter dropdown */
|
||||
@media (max-width: 768px) {
|
||||
.dropdown-menu {
|
||||
min-width: 95vw !important;
|
||||
max-width: 95vw !important;
|
||||
}
|
||||
|
||||
select[multiple] {
|
||||
min-height: 180px;
|
||||
max-height: 375px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.filterbody .row > div {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
select[multiple] {
|
||||
min-height: 150px;
|
||||
max-height: 300px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -52,7 +157,9 @@
|
||||
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="messages my-1 me-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
|
||||
<!-- Radio Selector -->
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<label class="my-1 me-2" for="radio"><?= __("Radio"); ?></label>
|
||||
<select class="form-select form-select-sm radios my-1 me-sm-2 w-auto" id="radio" name="radio">
|
||||
<option value="0" selected="selected"><?= __("None"); ?></option>
|
||||
@@ -63,55 +170,98 @@
|
||||
} ?>><?php echo $row->radio; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<label class="my-1 me-2" for="cwnSelect"><?= __("DXCC-Status"); ?></label>
|
||||
<select class="form-select form-select-sm my-1 me-sm-2 w-auto" id="cwnSelect" name="dxcluster_cwn" aria-describedby="dxcluster_cwnHelp" required>
|
||||
<option value="All"><?= __("All"); ?></option>
|
||||
<option value="notwkd"><?= __("Not worked"); ?></option>
|
||||
<option value="wkd"><?= __("Worked"); ?></option>
|
||||
<option value="cnf"><?= __("Confirmed"); ?></option>
|
||||
<option value="ucnf"><?= __("Worked, not Confirmed"); ?></option>
|
||||
</select>
|
||||
<label class="my-1 me-2" for="decontSelect"><?= __("Spots de"); ?></label>
|
||||
<select class="form-select form-select-sm my-1 me-sm-2 w-auto" id="decontSelect" name="dxcluster_decont" aria-describedby="dxcluster_decontHelp" required>
|
||||
<option value="Any"><?= __("All"); ?></option>
|
||||
<option value="AF" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'AF') {echo " selected";} ?>><?= __("Africa"); ?></option>
|
||||
<option value="AN" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'AN') {echo " selected";} ?>><?= __("Antarctica"); ?></option>
|
||||
<option value="AS" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'AS') {echo " selected";} ?>><?= __("Asia"); ?></option>
|
||||
<option value="EU" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'EU') {echo " selected";} ?>><?= __("Europe"); ?></option>
|
||||
<option value="NA" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'NA') {echo " selected";} ?>><?= __("North America"); ?></option>
|
||||
<option value="OC" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'OC') {echo " selected";} ?>><?= __("Oceania"); ?></option>
|
||||
<option value="SA" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'SA') {echo " selected";} ?>><?= __("South America"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label class="my-1 me-2" for="band"><?= __("Band"); ?></label>
|
||||
<select id="band" class="form-select form-select-sm my-1 me-sm-2 w-auto" name="band">
|
||||
<option value="All"><?= __("All"); ?></option>
|
||||
<?php foreach ($bands as $key => $bandgroup) {
|
||||
echo '<optgroup label="' . strtoupper($key) . '">';
|
||||
foreach ($bandgroup as $band) {
|
||||
echo '<option value="' . $band . '"';
|
||||
if ($band == "20m") echo ' selected';
|
||||
echo '>' . $band . '</option>' . "\n";
|
||||
}
|
||||
echo '</optgroup>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label class="my-1 me-2" for="mode"><?= __("Mode"); ?></label>
|
||||
<select id="mode" class="form-select form-select-sm my-1 me-sm-2 w-auto" name="mode">
|
||||
<option value="All"><?= __("All"); ?></option>
|
||||
<option value="phone"><?= __("Phone"); ?></option>
|
||||
<option value="cw"><?= __("CW"); ?></option>
|
||||
<option value="digi"><?= __("Digi"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Filters Section -->
|
||||
<div class="row pt-2">
|
||||
<div class="col-12">
|
||||
<div class="btn-toolbar d-flex flex-wrap align-items-center gap-2" role="toolbar">
|
||||
<!-- Filter Button Group -->
|
||||
<div class="btn-group" role="group">
|
||||
<!-- Main Filters Dropdown -->
|
||||
<div class="dropdown" data-bs-auto-close="outside">
|
||||
<button class="btn btn-sm btn-primary dropdown-toggle" type="button" id="filterDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fas fa-filter"></i> <?= __("Filters"); ?>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-start p-3 mt-2" aria-labelledby="filterDropdown" style="min-width: 800px; max-width: 95vw; max-height: 80vh; overflow-y: auto;">
|
||||
<div class="alert alert-info mb-3 py-2" role="alert">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
<small><strong><?= __("Tip:"); ?></strong> <?= __("Hold Ctrl (Windows) or Cmd (Mac) to select multiple options. Use 'All' to select everything."); ?></small>
|
||||
</div>
|
||||
<div class="card-body filterbody">
|
||||
<div class="row">
|
||||
<div class="mb-3 col-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<label class="form-label" for="cwnSelect"><?= __("DXCC-Status"); ?></label>
|
||||
<select class="form-select form-select-sm border border-secondary" id="cwnSelect" name="dxcluster_cwn" multiple="multiple" aria-describedby="dxcluster_cwnHelp">
|
||||
<option value="All" selected><?= __("All"); ?></option>
|
||||
<option value="notwkd"><?= __("Not worked"); ?></option>
|
||||
<option value="wkd"><?= __("Worked"); ?></option>
|
||||
<option value="cnf"><?= __("Confirmed"); ?></option>
|
||||
<option value="ucnf"><?= __("Worked, not Confirmed"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3 col-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<label class="form-label" for="decontSelect"><?= __("Spots de"); ?></label>
|
||||
<select class="form-select form-select-sm border border-secondary" id="decontSelect" name="dxcluster_decont" multiple="multiple" aria-describedby="dxcluster_decontHelp">
|
||||
<option value="Any" selected><?= __("All"); ?></option>
|
||||
<option value="AF" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'AF') {echo " selected";} ?>><?= __("Africa"); ?></option>
|
||||
<option value="AN" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'AN') {echo " selected";} ?>><?= __("Antarctica"); ?></option>
|
||||
<option value="AS" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'AS') {echo " selected";} ?>><?= __("Asia"); ?></option>
|
||||
<option value="EU" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'EU') {echo " selected";} ?>><?= __("Europe"); ?></option>
|
||||
<option value="NA" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'NA') {echo " selected";} ?>><?= __("North America"); ?></option>
|
||||
<option value="OC" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'OC') {echo " selected";} ?>><?= __("Oceania"); ?></option>
|
||||
<option value="SA" <?php if ($this->optionslib->get_option('dxcluster_decont') == 'SA') {echo " selected";} ?>><?= __("South America"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3 col-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<label class="form-label" for="band"><?= __("Band"); ?></label>
|
||||
<select id="band" class="form-select form-select-sm border border-secondary" name="band" multiple="multiple">
|
||||
<option value="All" selected><?= __("All"); ?></option>
|
||||
<?php foreach ($bands as $key => $bandgroup) {
|
||||
echo '<optgroup label="' . strtoupper($key) . '">';
|
||||
foreach ($bandgroup as $band) {
|
||||
echo '<option value="' . $band . '"';
|
||||
echo '>' . $band . '</option>' . "\n";
|
||||
}
|
||||
echo '</optgroup>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3 col-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<label class="form-label" for="mode"><?= __("Mode"); ?></label>
|
||||
<select id="mode" class="form-select form-select-sm border border-secondary" name="mode" multiple="multiple">
|
||||
<option value="All" selected><?= __("All"); ?></option>
|
||||
<option value="phone"><?= __("Phone"); ?></option>
|
||||
<option value="cw"><?= __("CW"); ?></option>
|
||||
<option value="digi"><?= __("Digi"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Apply Filters Button -->
|
||||
<button type="button" class="btn btn-sm btn-success" id="applyFiltersButton" disabled>
|
||||
<i class="fas fa-check"></i> <?= __("Apply Filters"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Search Input -->
|
||||
<div class="input-group input-group-sm" style="max-width: 250px;">
|
||||
<span class="input-group-text"><i class="fas fa-search"></i></span>
|
||||
<input type="text" class="form-control" id="spotSearchInput" placeholder="<?= __("Search spots..."); ?>" aria-label="<?= __("Search"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<div class='m-2'>
|
||||
<table style="width:100%;" class="table-sm table spottable table-bordered table-hover table-striped table-condensed">
|
||||
<div class="container">
|
||||
<table class="table-sm table spottable table-bordered table-hover table-striped table-condensed">
|
||||
<thead>
|
||||
<tr class="log_title titles">
|
||||
<th style="width:200px;"><?= __("Date"); ?>/<?= __("Time"); ?></th>
|
||||
|
||||
@@ -9,6 +9,8 @@ $(function() {
|
||||
function get_dtable () {
|
||||
var table = $('.spottable').DataTable({
|
||||
"paging": false,
|
||||
"searching": true,
|
||||
"dom": 'rt', // Only show table (r) and processing (t), hide search box and other elements
|
||||
"retrieve": true,
|
||||
"language": {
|
||||
url: getDataTablesLanguageUrl(),
|
||||
@@ -45,8 +47,34 @@ $(function() {
|
||||
function fill_list(band, de, maxAgeMinutes, cwn, mode) {
|
||||
// var table = $('.spottable').DataTable();
|
||||
var table = get_dtable();
|
||||
if ((band != '') && (band !== undefined)) {
|
||||
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de + "/" + mode;
|
||||
|
||||
// Handle multi-select values
|
||||
let bands = Array.isArray(band) ? band : [band];
|
||||
let continents = Array.isArray(de) ? de : [de];
|
||||
let cwnStatuses = Array.isArray(cwn) ? cwn : [cwn];
|
||||
let modes = Array.isArray(mode) ? mode : [mode];
|
||||
|
||||
// If 'All' is selected or nothing selected, treat as all
|
||||
if (bands.includes('All') || bands.length === 0) {
|
||||
bands = ['All'];
|
||||
}
|
||||
if (continents.includes('Any') || continents.length === 0) {
|
||||
continents = ['Any'];
|
||||
}
|
||||
if (cwnStatuses.includes('All') || cwnStatuses.length === 0) {
|
||||
cwnStatuses = ['All'];
|
||||
}
|
||||
if (modes.includes('All') || modes.length === 0) {
|
||||
modes = ['All'];
|
||||
}
|
||||
|
||||
// For now, use first band for API call (we'll need to make multiple calls or update API for multi-band)
|
||||
let bandForAPI = bands.includes('All') ? 'All' : bands[0];
|
||||
let continentForAPI = continents.includes('Any') ? 'Any' : continents[0];
|
||||
let modeForAPI = modes.includes('All') ? 'All' : modes[0];
|
||||
|
||||
if ((bandForAPI != '') && (bandForAPI !== undefined)) {
|
||||
let dxurl = dxcluster_provider + "/spots/" + bandForAPI + "/" +maxAgeMinutes + "/" + continentForAPI + "/" + modeForAPI;
|
||||
$.ajax({
|
||||
url: dxurl,
|
||||
cache: false,
|
||||
@@ -59,10 +87,16 @@ $(function() {
|
||||
if (dxspots.length>0) {
|
||||
dxspots.sort(SortByQrg);
|
||||
dxspots.forEach((single) => {
|
||||
if ((cwn == 'notwkd') && ((single.worked_dxcc))) { return; }
|
||||
if ((cwn == 'wkd') && (!(single.worked_dxcc))) { return; }
|
||||
if ((cwn == 'cnf') && (!(single.cnfmd_dxcc))) { return; }
|
||||
if ((cwn == 'ucnf') && (!(single.worked_dxcc) || single.cnfmd_dxcc)) { return; }
|
||||
// Apply multi-select filtering
|
||||
let passesCwnFilter = cwnStatuses.includes('All');
|
||||
if (!passesCwnFilter) {
|
||||
if (cwnStatuses.includes('notwkd') && !single.worked_dxcc) passesCwnFilter = true;
|
||||
if (cwnStatuses.includes('wkd') && single.worked_dxcc) passesCwnFilter = true;
|
||||
if (cwnStatuses.includes('cnf') && single.cnfmd_dxcc) passesCwnFilter = true;
|
||||
if (cwnStatuses.includes('ucnf') && single.worked_dxcc && !single.cnfmd_dxcc) passesCwnFilter = true;
|
||||
}
|
||||
if (!passesCwnFilter) { return; }
|
||||
|
||||
spots2render++;
|
||||
var data=[];
|
||||
if (single.cnfmd_dxcc) {
|
||||
@@ -180,27 +214,49 @@ $(function() {
|
||||
var table=get_dtable();
|
||||
table.order([1, 'asc']);
|
||||
table.clear();
|
||||
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage, $('#cwnSelect option:selected').val(), $('#mode option:selected').val());
|
||||
setInterval(function () { fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage, $('#cwnSelect option:selected').val(), $('#mode option:selected').val()); },60000);
|
||||
|
||||
$("#cwnSelect").on("change",function() {
|
||||
// Function to get selected values from multi-select
|
||||
function getSelectedValues(selectId) {
|
||||
let values = $('#' + selectId).val();
|
||||
if (!values || values.length === 0) {
|
||||
return ['All'];
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
// Function to apply filters
|
||||
function applyFilters() {
|
||||
let band = getSelectedValues('band');
|
||||
let de = getSelectedValues('decontSelect');
|
||||
let cwn = getSelectedValues('cwnSelect');
|
||||
let mode = getSelectedValues('mode');
|
||||
|
||||
table.clear();
|
||||
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage, $('#cwnSelect option:selected').val(), $('#mode option:selected').val());
|
||||
fill_list(band, de, dxcluster_maxage, cwn, mode);
|
||||
}
|
||||
|
||||
// Initial load
|
||||
applyFilters();
|
||||
|
||||
// Auto-refresh every 60 seconds
|
||||
setInterval(function () { applyFilters(); }, 60000);
|
||||
|
||||
// Apply filters button click
|
||||
$("#applyFiltersButton").on("click", function() {
|
||||
applyFilters();
|
||||
// Disable button after applying filters
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
|
||||
$("#decontSelect").on("change",function() {
|
||||
table.clear();
|
||||
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage, $('#cwnSelect option:selected').val(), $('#mode option:selected').val());
|
||||
// Connect search input to DataTable
|
||||
$("#spotSearchInput").on("keyup", function() {
|
||||
table.search(this.value).draw();
|
||||
});
|
||||
|
||||
$("#band").on("change",function() {
|
||||
table.clear();
|
||||
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage, $('#cwnSelect option:selected').val(), $('#mode option:selected').val());
|
||||
});
|
||||
|
||||
$("#mode").on("change",function() {
|
||||
table.clear();
|
||||
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(), dxcluster_maxage, $('#cwnSelect option:selected').val(), $('#mode option:selected').val());
|
||||
// Remove old individual change handlers and keep only for specific use cases
|
||||
// Note: Radio selector still triggers immediate update
|
||||
$("#radio").on("change", function() {
|
||||
// Radio change doesn't affect filters, handled separately
|
||||
});
|
||||
|
||||
$("#spottertoggle").on("click", function() {
|
||||
|
||||
Reference in New Issue
Block a user