2024-02-29 19:35:37 +01:00
|
|
|
<script lang="ts">
|
2025-03-12 17:00:16 -04:00
|
|
|
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
|
|
|
|
import { user } from '$lib/stores/user.store';
|
|
|
|
|
import { searchUsersAdmin } from '@immich/sdk';
|
|
|
|
|
import { Button } from '@immich/ui';
|
2024-02-29 19:35:37 +01:00
|
|
|
import { mdiFolderSync } from '@mdi/js';
|
|
|
|
|
import { onMount } from 'svelte';
|
2024-06-04 21:53:00 +02:00
|
|
|
import { t } from 'svelte-i18n';
|
2025-03-12 17:00:16 -04:00
|
|
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
2024-02-29 19:35:37 +01:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
interface Props {
|
|
|
|
|
onCancel: () => void;
|
|
|
|
|
onSubmit: (ownerId: string) => void;
|
|
|
|
|
}
|
2024-09-20 23:02:58 +02:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
let { onCancel, onSubmit }: Props = $props();
|
2024-02-29 19:35:37 +01:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
let ownerId: string = $state($user.id);
|
|
|
|
|
|
|
|
|
|
let userOptions: { value: string; text: string }[] = $state([]);
|
2024-02-29 19:35:37 +01:00
|
|
|
|
|
|
|
|
onMount(async () => {
|
2024-05-26 18:15:52 -04:00
|
|
|
const users = await searchUsersAdmin({});
|
2024-02-29 19:35:37 +01:00
|
|
|
userOptions = users.map((user) => ({ value: user.id, text: user.name }));
|
|
|
|
|
});
|
2024-11-14 08:43:25 -06:00
|
|
|
|
|
|
|
|
const onsubmit = (event: Event) => {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
onSubmit(ownerId);
|
|
|
|
|
};
|
2024-02-29 19:35:37 +01:00
|
|
|
</script>
|
|
|
|
|
|
2024-09-20 23:02:58 +02:00
|
|
|
<FullScreenModal title={$t('select_library_owner')} icon={mdiFolderSync} onClose={onCancel}>
|
2024-11-14 08:43:25 -06:00
|
|
|
<form {onsubmit} autocomplete="off" id="select-library-owner-form">
|
2024-06-12 12:54:40 +02:00
|
|
|
<p class="p-5 text-sm">{$t('admin.note_cannot_be_changed_later')}</p>
|
2024-02-29 19:35:37 +01:00
|
|
|
|
2024-04-08 21:02:09 +00:00
|
|
|
<SettingSelect bind:value={ownerId} options={userOptions} name="user" />
|
|
|
|
|
</form>
|
2024-11-14 08:43:25 -06:00
|
|
|
|
|
|
|
|
{#snippet stickyBottom()}
|
2025-03-12 17:00:16 -04:00
|
|
|
<Button shape="round" color="secondary" fullWidth onclick={onCancel}>{$t('cancel')}</Button>
|
|
|
|
|
<Button shape="round" type="submit" fullWidth form="select-library-owner-form">{$t('create')}</Button>
|
2024-11-14 08:43:25 -06:00
|
|
|
{/snippet}
|
2024-02-29 19:35:37 +01:00
|
|
|
</FullScreenModal>
|