checkbox filters from config

This commit is contained in:
Tykayn 2025-04-27 21:24:25 +02:00 committed by tykayn
parent c1a76c9701
commit b44fa95a09
3 changed files with 39 additions and 0 deletions

View file

@ -118,6 +118,23 @@
<div class="filter-group">
qualité
<button id="filterUnkown">❓ kW max inconnu</button>
<div class="filter-group">
<label>
<input type="checkbox" id="filterCableAttached"> Prise avec câble attaché
</label>
<br>
<label>
<input type="checkbox" id="filterCCS"> Prise CCS
</label>
<br>
<label>
<input type="checkbox" id="filterType2"> Prise Type 2
</label>
<br>
<label>
<input type="checkbox" id="filterQuality"> Contrôle qualité
</label>
</div>
<!--
<br>
<fieldset class="wip">

View file

@ -7,6 +7,18 @@ const lcm_config = {
hide_osmose_markers_if_close_to_existing_charging_stations_distance: 5, // meters
max_possible_station_output: 400,
// Filtres pour les prises
filterCableAttached: false,
filterCCS: false,
filterType2: false,
filterQuality: false,
// Configuration des filtres
filterConfigs: {
'filterCableAttached': false,
'filterCCS': false,
'filterType2': false,
'filterQuality': false
},
tileServers: {
osm: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
cycle: 'https://{s}.tile.thunderforest.org/cycle/{z}/{x}/{y}.png',

View file

@ -905,6 +905,16 @@ $(document).ready(function () {
refreshDisplay();
});
showActiveFilter(display_unknown_max_power_station, '#filterUnkown');
$('#shareUrl').on('click', copyCurrentUrl);
// Écouteurs pour les nouveaux filtres
Object.keys(lcm_config.filterConfigs).forEach(filterId => {
$(`#${filterId}`).on('change', function() {
lcm_config[lcm_config.filterConfigs[filterId]] = this.checked;
refreshDisplay();
});
});
});
function showActiveFilter(filterVariableName, selectorId) {