This commit is contained in:
Philipp Dormann 2025-05-20 01:28:33 +02:00
parent 9ef34359d8
commit a00af08b3f
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314
2 changed files with 8 additions and 4 deletions

View File

@ -95,7 +95,7 @@
<div class="mt-4 p-3 bg-green-50 border border-green-200 rounded-md"> <div class="mt-4 p-3 bg-green-50 border border-green-200 rounded-md">
<p class="text-black"> <p class="text-black">
{$_("last-created-donation")}: #{last_created.id}: {last_created.amountPerDistance / {$_("last-created-donation")}: #{last_created.id}: {last_created.amountPerDistance /
100} € für {getRunnerLabel(last_created.runner)} von {getRunnerLabel( 100}€ für {getRunnerLabel(last_created.runner)} von {getRunnerLabel(
last_created.donor last_created.donor
)} )}
</p> </p>
@ -110,8 +110,12 @@
console.log("Cleared selection"); console.log("Cleared selection");
}} }}
options={runners} options={runners}
filterFn={(option, searchTerm) => { filterFn={(item, searchTerm) => {
return option.label.toLowerCase().includes(searchTerm.toLowerCase()); if (searchTerm.startsWith("#")) {
const id = parseInt(searchTerm.replace("#", ""));
return item.value.id === id;
}
return item.label.toLowerCase().includes(searchTerm.toLowerCase());
}} }}
bind:selected={runnerinfo} bind:selected={runnerinfo}
inputAriaLabel={$_("search-for-runner-by-name-or-id")} inputAriaLabel={$_("search-for-runner-by-name-or-id")}

View File

@ -77,7 +77,7 @@
function selectOption(option) { function selectOption(option) {
selected = option.value; selected = option.value;
isOpen = false; isOpen = false;
searchTerm = option.label; searchTerm = option.label; // Set searchTerm to the selected option's label
focusedIndex = -1; focusedIndex = -1;
dispatch("onSelected", option.value); dispatch("onSelected", option.value);
} }