Working on next alarm retrieval
This commit is contained in:
parent
6e54ad1a87
commit
9a06d04ce0
8 changed files with 261 additions and 40 deletions
|
|
@ -51,9 +51,7 @@
|
|||
objP.then((o) => obj = o);
|
||||
}
|
||||
|
||||
function editThis() {
|
||||
goto('alarms/' + $page.params["kind"]);
|
||||
}
|
||||
let edit = false;
|
||||
|
||||
function deleteThis() {
|
||||
obj.delete().then(() => {
|
||||
|
|
@ -84,6 +82,11 @@
|
|||
<h2 class="mb-0">
|
||||
{slugToTitle($page.params["kind"])} du <DateFormat date={alarm.time} dateStyle="long" />
|
||||
</h2>
|
||||
{#if alarm.comment}
|
||||
<p>
|
||||
{alarm.comment}
|
||||
</p>
|
||||
{/if}
|
||||
<ListGroup class="my-2">
|
||||
<ListGroupItem>
|
||||
<strong>Date du réveil</strong> <DateFormat date={alarm.time} dateStyle="long" />
|
||||
|
|
@ -100,8 +103,13 @@
|
|||
</div>
|
||||
{:then alarm}
|
||||
<h2 class="mb-0">
|
||||
{slugToTitle($page.params["kind"])} des {weekdayStr(alarm.weekday)} à {alarm.time}
|
||||
{slugToTitle($page.params["kind"])} des {weekdayStr(alarm.weekday)}s à {alarm.time}
|
||||
</h2>
|
||||
{#if alarm.comment}
|
||||
<p>
|
||||
{alarm.comment}
|
||||
</p>
|
||||
{/if}
|
||||
<ListGroup class="my-2">
|
||||
<ListGroupItem>
|
||||
<strong>Jour de la semaine</strong> {weekdayStr(alarm.weekday)}
|
||||
|
|
@ -112,7 +120,22 @@
|
|||
<ListGroupItem>
|
||||
<strong>Ignorer les exceptions ?</strong> {alarm.ignore_exceptions?"oui":"non"}
|
||||
</ListGroupItem>
|
||||
{#if alarm.next_time}
|
||||
<ListGroupItem>
|
||||
<strong>Prochaine occurrence</strong> <DateFormat date={new Date(alarm.next_time)} dateStyle="long" />
|
||||
</ListGroupItem>
|
||||
{/if}
|
||||
</ListGroup>
|
||||
{#if alarm.excepts}
|
||||
<h3>Prochaines exceptions</h3>
|
||||
<ListGroup class="my-2">
|
||||
{#each alarm.excepts as except}
|
||||
<ListGroupItem>
|
||||
<DateFormat date={new Date(except)} dateStyle="long" />
|
||||
</ListGroupItem>
|
||||
{/each}
|
||||
</ListGroup>
|
||||
{/if}
|
||||
{/await}
|
||||
{:else if $page.params["kind"] == "exceptions"}
|
||||
{#await objP}
|
||||
|
|
@ -123,30 +146,37 @@
|
|||
<h2 class="mb-0">
|
||||
{slugToTitle($page.params["kind"])} du <DateRangeFormat startDate={exception._start()} endDate={exception._end()} dateStyle="long" />
|
||||
</h2>
|
||||
{#if exception.comment}
|
||||
<p>
|
||||
{exception.comment}
|
||||
</p>
|
||||
{/if}
|
||||
Entre le <DateRangeFormat startDate={exception._start()} endDate={exception._end()} dateStyle="long" />
|
||||
{/await}
|
||||
{/if}
|
||||
|
||||
{#await objP then alarm}
|
||||
<ListGroup class="my-2 text-center">
|
||||
<ListGroupItem
|
||||
action
|
||||
tag="button"
|
||||
class="text-info fw-bold"
|
||||
on:click={editThis}
|
||||
>
|
||||
<Icon name="pencil" />
|
||||
Éditer ce {slugToTitle($page.params["kind"]).toLowerCase()}
|
||||
</ListGroupItem>
|
||||
<ListGroupItem
|
||||
action
|
||||
tag="button"
|
||||
class="text-danger fw-bold"
|
||||
on:click={deleteThis}
|
||||
>
|
||||
<Icon name="trash" />
|
||||
Supprimer ce {slugToTitle($page.params["kind"]).toLowerCase()}
|
||||
</ListGroupItem>
|
||||
</ListGroup>
|
||||
{/await}
|
||||
{#if !edit}
|
||||
{#await objP then alarm}
|
||||
<ListGroup class="my-2 text-center">
|
||||
<ListGroupItem
|
||||
action
|
||||
tag="button"
|
||||
class="text-info fw-bold"
|
||||
on:click={() => edit = !edit}
|
||||
>
|
||||
<Icon name="pencil" />
|
||||
Éditer ce {slugToTitle($page.params["kind"]).toLowerCase()}
|
||||
</ListGroupItem>
|
||||
<ListGroupItem
|
||||
action
|
||||
tag="button"
|
||||
class="text-danger fw-bold"
|
||||
on:click={deleteThis}
|
||||
>
|
||||
<Icon name="trash" />
|
||||
Supprimer ce {slugToTitle($page.params["kind"]).toLowerCase()}
|
||||
</ListGroupItem>
|
||||
</ListGroup>
|
||||
{/await}
|
||||
{/if}
|
||||
</Container>
|
||||
|
|
|
|||
|
|
@ -148,6 +148,11 @@
|
|||
</FormGroup>
|
||||
{/if}
|
||||
|
||||
<FormGroup>
|
||||
<Label for="comment">Commentaire</Label>
|
||||
<Input id="comment" type="text" bind:value={obj.comment} />
|
||||
</FormGroup>
|
||||
|
||||
<Button type="submit" color="primary" class="d-none d-md-block">
|
||||
Ajouter
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue