mirror of
https://github.com/we-promise/sure.git
synced 2026-05-25 21:44:56 +00:00
* fix(enable_banking): match bank list search against BIC, not just name Bank-search filter on the Enable Banking bank-selection modal only indexed `aspsp[:name]`, so users searching by BIC code (e.g. `INGDDEFF`) got no results even when the bank was rendered in the list. Switch the per-item data attribute to a `name + BIC` haystack and read from it in the Stimulus controller, so either token matches. Refs #1814 * style(bank_search): apply Biome formatting to forEach callback (#1874 review)
20 lines
585 B
JavaScript
20 lines
585 B
JavaScript
import { Controller } from "@hotwired/stimulus";
|
|
|
|
export default class extends Controller {
|
|
static targets = ["input", "item", "emptyState"];
|
|
|
|
filter() {
|
|
const query = this.inputTarget.value.toLocaleLowerCase().trim();
|
|
let visibleCount = 0;
|
|
|
|
this.itemTargets.forEach((item) => {
|
|
const haystack = (item.dataset.bankSearch ?? "").toLocaleLowerCase();
|
|
const match = haystack.includes(query);
|
|
item.style.display = match ? "" : "none";
|
|
if (match) visibleCount++;
|
|
});
|
|
|
|
this.emptyStateTarget.classList.toggle("hidden", visibleCount > 0);
|
|
}
|
|
}
|