Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue 525 #529

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/components/EntitySearch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
isSearching = true;
timeout = setTimeout(getEntities(searchValue), 300);
};
export let year: number | undefined = undefined;

let timeout: ReturnType<typeof setTimeout> | undefined = undefined;

Expand All @@ -31,6 +32,9 @@

const url = new URL($page.url.origin + endpoint);
url.searchParams.append("search", searchValue);
if (year) {
url.searchParams.append("year", year.toString());
}
const data = await fetch(url, {
method: "GET",
})
Expand Down
2 changes: 2 additions & 0 deletions src/lib/components/MemberSearch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export let onSelect: ((member: Member) => void) | undefined;
export let handleSearch: (searchValue: string) => void;
export let endpoint = "/api/members";
export let year: number | undefined = undefined;

const getOption = (option: unknown) => option as Member;
</script>
Expand All @@ -19,6 +20,7 @@
bind:onSelect
bind:handleSearch
{...$$restProps}
{year}
>
<slot />
<div slot="entity" let:option>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/components/forms/MemberSearchInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
let isSearching: boolean;
let handleSearch: (search: string) => void;
export let endpoint: string | undefined = undefined;
export let year: number | undefined = undefined;
</script>

<MemberSearch
Expand All @@ -20,6 +21,7 @@
onSelect={(selectedMember) => {
member = selectedMember;
}}
{year}
>
<div class="relative flex h-full flex-col gap-2">
{#if member}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { Member } from "@prisma/client";
import MemberSearchInput from "$lib/components/forms/MemberSearchInput.svelte";

export let year: number | undefined = undefined;
export let phadder = false;
export let groupId: string;
let member: Member | undefined = undefined;
Expand All @@ -26,6 +27,7 @@
bind:member
class="flex-1"
endpoint={phadder ? "/api/members/phadders" : undefined}
{year}
/>
<button type="submit" disabled={!member} class="btn btn-primary">+</button>
<input type="hidden" name="groupId" value={groupId} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
</ul>
</div>
</ScrollIndicatedBox>
<AddPersonInput groupId={group.id} phadder />
<AddPersonInput groupId={group.id} phadder year={group.year} />
</div>
{/if}
</div>
Loading