first commit

This commit is contained in:
2020-12-31 17:49:54 +01:00
commit 2240985aa1
120 changed files with 11574 additions and 0 deletions
@@ -0,0 +1,31 @@
<script lang="ts">
import groupStore from "../stores/group";
export let value = "";
export let name = "";
$: {
if ($groupStore.stale && !$groupStore.loading) {
groupStore.load();
}
}
$: {
if ($groupStore.groups.length > 0 && value === "") {
const nonEmpty = $groupStore.groups.find(g => g.items.length > 0);
if (nonEmpty != null) {
value = nonEmpty.items[0].id;
}
}
}
</script>
<select name={name} bind:value={value} disabled={$groupStore.loading}>
{#each $groupStore.groups as group (group.id)}
<optgroup label={group.name}>
{#each group.items as item (item.id)}
<option value={item.id} selected={item.id === value}>{item.name} ({item.groupWeight})</option>
{/each}
</optgroup>
{/each}
</select>