From 77662b9c19bbef57c49471d9326b48656aebf1ff Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Thu, 18 Mar 2021 16:04:20 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20select=20bug=20for=20sponsoring=20modal?= =?UTF-8?q?=20=F0=9F=90=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #98 --- .../donations/AddDonationModal.svelte | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/components/donations/AddDonationModal.svelte b/src/components/donations/AddDonationModal.svelte index ab9dd2a2..63e781e3 100644 --- a/src/components/donations/AddDonationModal.svelte +++ b/src/components/donations/AddDonationModal.svelte @@ -15,7 +15,7 @@ option.firstname + " " + (option.middlename || "") + " " + option.lastname; const filterDonors = (label, filterText, option) => label.toLowerCase().includes(filterText.toLowerCase()) || - option.id.toString().startsWith(filterText.toLowerCase()); + option.value.id.toString().startsWith(filterText.toLowerCase()); function focus(el) { el.focus(); } @@ -25,12 +25,14 @@ $: runners = []; $: is_fixed = false; DonorService.donorControllerGetAll().then((val) => { - donors = val; - donor = donors[0].id || 0; + donors = val.map((r) => { + return { label: getDonorLabel(r), value: r }; + }); }); RunnerService.runnerControllerGetAll().then((val) => { - runners = val; - runner = runners[0].id || 0; + runners = val.map((r) => { + return { label: getDonorLabel(r), value: r }; + }); }); $: amount_input = 0; $: processed_last_submit = true; @@ -184,7 +186,6 @@

- {#if is_fixed} {$_('create-a-new-fixed-donation')} {:else}{$_('create-a-new-distance-donation')}{/if} @@ -213,15 +214,13 @@ class="block text-sm font-medium text-gray-700">{$_('donor')} getDonorLabel(option)} - getOptionLabel={(option) => getDonorLabel(option)} itemFilter={(label, filterText, option) => filterDonors(label, filterText, option)} items={runners} showChevron={true} placeholder={$_('search-for-runner-by-name-or-id')} noOptionsMessage={$_('no-runners-found')} - on:select={(selectedValue) => (runner = selectedValue.detail.id)} - on:clear={()=>(runner = null)} /> + on:select={(selectedValue) => (runner = selectedValue.detail.value.id)} + on:clear={() => (runner = null)} />

{/if}