fix(patching/import): comparaison filtres case-insensitive (production == Production)
- applyFilters: comparaisons en lowercase pour intervenant et env - rebuildSelectOptions: dedup case-insensitive (Map<lowercase, canonical>) garde la 1re forme rencontree comme label affiche
This commit is contained in:
parent
f539c604d6
commit
2b57ca3247
@ -266,12 +266,13 @@
|
||||
}
|
||||
|
||||
function applyFilters(){
|
||||
const fi = (fInter.value || '').trim();
|
||||
const fe = (fEnv.value || '').trim();
|
||||
// Comparaisons case-insensitive (Production == production, etc.)
|
||||
const fi = (fInter.value || '').trim().toLowerCase();
|
||||
const fe = (fEnv.value || '').trim().toLowerCase();
|
||||
let visibleCount = 0;
|
||||
tbody.querySelectorAll('tr').forEach(tr => {
|
||||
const i = tr.dataset.intervenant || '';
|
||||
const e = tr.dataset.env || '';
|
||||
const i = (tr.dataset.intervenant || '').toLowerCase();
|
||||
const e = (tr.dataset.env || '').toLowerCase();
|
||||
const ok = (!fi || i === fi) && (!fe || e === fe);
|
||||
if (ok) { tr.classList.remove('row-hidden'); tr.style.display=''; visibleCount++; }
|
||||
else { tr.classList.add('row-hidden'); tr.style.display='none'; }
|
||||
@ -281,8 +282,17 @@
|
||||
}
|
||||
|
||||
function rebuildSelectOptions(sel, values, placeholder){
|
||||
// Dedup case-insensitive : on garde la 1re forme rencontrée comme canonique
|
||||
// (généralement la majuscule "Production" si elle apparaît avant "production")
|
||||
const cur = sel.value;
|
||||
const opts = Array.from(new Set(values.filter(x => x))).sort((a,b) => a.localeCompare(b, 'fr', {sensitivity:'base'}));
|
||||
const seen = new Map(); // lowercase -> canonical form
|
||||
for (const v of values) {
|
||||
if (!v) continue;
|
||||
const k = v.toLowerCase();
|
||||
if (!seen.has(k)) seen.set(k, v);
|
||||
}
|
||||
const opts = Array.from(seen.values()).sort((a,b) =>
|
||||
a.localeCompare(b, 'fr', {sensitivity:'base'}));
|
||||
sel.innerHTML = '<option value="">' + placeholder + '</option>'
|
||||
+ opts.map(v => '<option value="' + escapeHTML(v) + '"' + (cur === v ? ' selected' : '') + '>' + escapeHTML(v) + '</option>').join('');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user