reveil/ui/src/routes/alarms/[kind]/new/+page.svelte

101 lines
3.1 KiB
Svelte

<script>
import {
Button,
Col,
Container,
Form,
FormGroup,
Input,
Label,
Row,
Icon,
} from 'sveltestrap';
import { page } from '$app/stores';
function slugToTitle(slug) {
switch(slug) {
case "manuals":
return "Nouveau réveil manuel";
case "usuals":
return "Nouveau réveil habituel";
case "excepts":
return "Nouvelle exception";
}
}
</script>
<Container fluid class="flex-fill">
<Form>
<Button type="submit" color="link" class="d-block d-md-none float-end">
Ajouter
</Button>
<h2 class="mb-0">
{slugToTitle($page.params["kind"])}
</h2>
{#if $page.params["kind"] == "manuals"}
<FormGroup>
<Label for="exampleHour">Heure</Label>
<Input id="exampleHour" type="datetime-local" required />
</FormGroup>
<FormGroup>
<Label for="routineSelect">Routines</Label>
<Input type="select" name="select" id="routineSelect">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</Input>
</FormGroup>
{:else if $page.params["kind"] == "usuals"}
<FormGroup>
<Label for="daySelect">Jour de la semaine</Label>
<Input type="select" id="daySelect" required>
<option value="1">Lundi</option>
<option value="2">Mardi</option>
<option value="3">Mercredi</option>
<option value="4">Jeudi</option>
<option value="5">Vendredi</option>
<option value="6">Samedi</option>
<option value="0">Dimanche</option>
</Input>
</FormGroup>
<FormGroup>
<Label for="exampleHour">Heure</Label>
<Input id="exampleHour" type="time" required />
</FormGroup>
<FormGroup>
<Label for="routineSelect">Routines</Label>
<Input type="select" id="routineSelect">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</Input>
</FormGroup>
<FormGroup>
<Input id="ignoreExceptions" type="checkbox" label="Ignorer les exceptions" />
</FormGroup>
{:else if $page.params["kind"] == "excepts"}
<FormGroup>
<Label for="exceptionStart">Date de début</Label>
<Input id="exceptionStart" type="date" required />
</FormGroup>
<FormGroup>
<Label for="exceptionEnd">Date de fin</Label>
<Input id="exceptionEnd" type="date" required />
</FormGroup>
{/if}
<Button type="submit" color="primary" class="d-none d-md-block">
Ajouter
</Button>
</Form>
</Container>