Remove Entity-Filter

This commit is contained in:
2026-01-16 15:44:18 +01:00
parent 20c0b8c9b8
commit f562158607
2 changed files with 9 additions and 57 deletions

View File

@@ -7,8 +7,7 @@
let entities = []; let entities = [];
let loading = true; let loading = true;
let error = null; let error = null;
let filter = 'all'; // all, worked, confirmed, unworked let sort = 'name'; // name
let sort = 'name'; // name, status
let groupedData = []; let groupedData = [];
let bands = []; let bands = [];
@@ -142,45 +141,17 @@
function getFilteredEntities() { function getFilteredEntities() {
let filtered = [...entities]; let filtered = [...entities];
// Apply status filter
switch (filter) {
case 'worked':
filtered = filtered.filter((e) => e.worked);
break;
case 'confirmed':
filtered = filtered.filter((e) => e.confirmed);
break;
case 'unworked':
filtered = filtered.filter((e) => !e.worked);
break;
}
// Apply sorting // Apply sorting
switch (sort) {
case 'name':
filtered.sort((a, b) => { filtered.sort((a, b) => {
const aName = String(a.entityName || a.entity || ''); const aName = String(a.entityName || a.entity || '');
const bName = String(b.entityName || b.entity || ''); const bName = String(b.entityName || b.entity || '');
return aName.localeCompare(bName); return aName.localeCompare(bName);
}); });
break;
case 'status':
filtered.sort((a, b) => {
if (a.confirmed && !b.confirmed) return -1;
if (!a.confirmed && b.confirmed) return 1;
if (a.worked && !b.worked) return -1;
if (!a.worked && b.worked) return 1;
const aName = String(a.entityName || a.entity || '');
const bName = String(b.entityName || b.entity || '');
return aName.localeCompare(bName);
});
break;
}
return filtered; return filtered;
} }
// Re-apply filter when filter/sort changes // Re-apply sort when entities or sort changes
$: if (entities.length > 0) { $: if (entities.length > 0) {
applyFilter(); applyFilter();
} }
@@ -205,21 +176,10 @@
</div> </div>
<div class="controls"> <div class="controls">
<div class="filter-group">
<label>Filter:</label>
<select bind:value={filter}>
<option value="all">All Entities</option>
<option value="worked">Worked</option>
<option value="confirmed">Confirmed</option>
<option value="unworked">Unworked</option>
</select>
</div>
<div class="sort-group"> <div class="sort-group">
<label>Sort by:</label> <label>Sort by:</label>
<select bind:value={sort}> <select bind:value={sort}>
<option value="name">Name</option> <option value="name">Name</option>
<option value="status">Status</option>
</select> </select>
</div> </div>
</div> </div>

View File

@@ -26,8 +26,7 @@
let filters = { let filters = {
band: '', band: '',
mode: '', mode: ''
confirmed: false
}; };
// Load QSOs on mount // Load QSOs on mount
@@ -54,7 +53,6 @@
const activeFilters = {}; const activeFilters = {};
if (filters.band) activeFilters.band = filters.band; if (filters.band) activeFilters.band = filters.band;
if (filters.mode) activeFilters.mode = filters.mode; if (filters.mode) activeFilters.mode = filters.mode;
if (filters.confirmed) activeFilters.confirmed = 'true';
activeFilters.page = currentPage; activeFilters.page = currentPage;
activeFilters.limit = pageSize; activeFilters.limit = pageSize;
@@ -180,8 +178,7 @@
currentPage = 1; currentPage = 1;
filters = { filters = {
band: '', band: '',
mode: '', mode: ''
confirmed: false
}; };
loadQSOs(); loadQSOs();
} }
@@ -380,11 +377,6 @@
{/each} {/each}
</select> </select>
<label class="checkbox-label">
<input type="checkbox" bind:checked={filters.confirmed} on:change={applyFilters}>
Confirmed only
</label>
<button class="btn btn-secondary" on:click={clearFilters}>Clear</button> <button class="btn btn-secondary" on:click={clearFilters}>Clear</button>
</div> </div>
</div> </div>