Add Team now uses the new select

ref #91
This commit is contained in:
Nicolai Ort 2021-03-14 20:25:58 +01:00
parent 6a925cb27f
commit 1da15783d5

View File

@ -6,6 +6,7 @@
RunnerOrganizationService, RunnerOrganizationService,
RunnerTeamService, RunnerTeamService,
} from "@odit/lfk-client-js"; } from "@odit/lfk-client-js";
import Select from "svelte-select";
import Toastify from "toastify-js"; import Toastify from "toastify-js";
export let modal_open; export let modal_open;
export let current_teams; export let current_teams;
@ -90,7 +91,7 @@
class="hidden sm:inline-block sm:align-middle sm:h-screen" class="hidden sm:inline-block sm:align-middle sm:h-screen"
aria-hidden="true">&#8203;</span> aria-hidden="true">&#8203;</span>
<div <div
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full" class="inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
role="dialog" role="dialog"
aria-modal="true" aria-modal="true"
aria-labelledby="modal-headline"> aria-labelledby="modal-headline">
@ -145,13 +146,25 @@
<label <label
for="firstname" for="firstname"
class="block text-sm font-medium text-gray-700">{$_('organization')}</label> class="block text-sm font-medium text-gray-700">{$_('organization')}</label>
<select <Select
bind:value={parentGroup} containerClasses="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2"> getSelectionLabel={(option) => {return option.name}}
{#each orgs as t} getOptionLabel={(option) => {return option.name}}
<option value={t.id}>{t.name}</option> itemFilter={(label, filterText, option) =>
{/each} label.toLowerCase().includes(filterText.toLowerCase()) ||
</select> option.id.toString().startsWith(filterText.toLowerCase())}
items={orgs}
showChevron={true}
placeholder={$_('search-for-an-organization-by-name-or-id')}
noOptionsMessage={$_('no-organizations-found')}
on:select={(selectedValue) => (parentGroup = selectedValue.detail.id)}
on:clear={()=>(parentGroup = null)} />
{#if !parentGroup}
<span
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
{$_('you-have-to-provide-an-organization')}
</span>
{/if}
</div> </div>
</div> </div>
</div> </div>