add round creation
This commit is contained in:
parent
9cc0ac3089
commit
764d0c0526
25 changed files with 356 additions and 27 deletions
41
src/lib/components/rounds/create-round.svelte
Normal file
41
src/lib/components/rounds/create-round.svelte
Normal file
|
@ -0,0 +1,41 @@
|
|||
<script lang="ts">
|
||||
import { superForm, type Infer, type SuperValidated } from 'sveltekit-superforms';
|
||||
import { FormControl } from '../ui/form';
|
||||
import FormDescription from '../ui/form/form-description.svelte';
|
||||
import FormFieldErrors from '../ui/form/form-field-errors.svelte';
|
||||
import FormField from '../ui/form/form-field.svelte';
|
||||
import FormLabel from '../ui/form/form-label.svelte';
|
||||
import { formSchema, type FormSchema } from './create-schema';
|
||||
import { zodClient } from 'sveltekit-superforms/adapters';
|
||||
import RadioGroup from '../ui/radio-group/radio-group.svelte';
|
||||
import RadioGroupItem from '../ui/radio-group/radio-group-item.svelte';
|
||||
import { SchedulingMode } from '@/app';
|
||||
|
||||
let { data }: { data: { form: SuperValidated<Infer<FormSchema>> } } = $props();
|
||||
|
||||
const form = superForm(data.form, {
|
||||
validators: zodClient(formSchema)
|
||||
});
|
||||
|
||||
const { form: formData, enhance } = form;
|
||||
</script>
|
||||
|
||||
<form method="post" use:enhance>
|
||||
<FormField {form} name="scheduling_mode">
|
||||
<RadioGroup required bind:value={$formData.scheduling_mode} name="scheduling_mode">
|
||||
{#each Object.values(SchedulingMode) as mode}
|
||||
<div class="flex items-center gap-4">
|
||||
<FormControl>
|
||||
{#snippet children({ props })}
|
||||
<RadioGroupItem value={mode} {...props} />
|
||||
<FormLabel>{mode}</FormLabel>
|
||||
{/snippet}
|
||||
</FormControl>
|
||||
</div>
|
||||
{/each}
|
||||
</RadioGroup>
|
||||
|
||||
<FormDescription />
|
||||
<FormFieldErrors />
|
||||
</FormField>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue