54 lines
1.7 KiB
Svelte
54 lines
1.7 KiB
Svelte
<script>
|
|
import { page } from '$app/stores';
|
|
|
|
import {
|
|
Button,
|
|
Icon,
|
|
Spinner,
|
|
} from '@sveltestrap/sveltestrap';
|
|
|
|
import DateRangeFormat from '$lib/components/DateRangeFormat.svelte';
|
|
import { alarmsExceptions } from '$lib/stores/alarmexceptions';
|
|
|
|
export let flush = false;
|
|
</script>
|
|
|
|
<div class="d-flex justify-content-between align-items-center" class:mx-2={flush}>
|
|
<h2>
|
|
Exceptions
|
|
</h2>
|
|
<Button
|
|
href="alarms/exceptions/new"
|
|
color="outline-primary"
|
|
size="sm"
|
|
class="float-end {($page.params.kind === 'exceptions' && $page.url.pathname.endsWith('/new'))?'active':''}"
|
|
>
|
|
<Icon name="plus-lg" />
|
|
</Button>
|
|
</div>
|
|
<div class="text-center">
|
|
{#if $alarmsExceptions.list !== null}
|
|
{#if $alarmsExceptions.list.length}
|
|
<div class="list-group" class:list-group-flush={flush}>
|
|
{#each $alarmsExceptions.list as alarm (alarm.id)}
|
|
<a
|
|
href="alarms/exceptions/{alarm.id}"
|
|
class="list-group-item list-group-item-action"
|
|
class:active={$page.params.kind === "exceptions" && $page.params.aid === alarm.id}
|
|
>
|
|
Du <DateRangeFormat startDate={alarm._start()} endDate={alarm._end()} dateStyle="long" />
|
|
</a>
|
|
{/each}
|
|
</div>
|
|
{:else}
|
|
<p class="fst-italic">Pas d'exception programmée</p>
|
|
{/if}
|
|
{:else}
|
|
{#await alarmsExceptions.refresh()}
|
|
<div class="d-flex justify-content-center align-items-center gap-2">
|
|
<Spinner color="primary" /> Chargement en cours…
|
|
</div>
|
|
{/await}
|
|
{/if}
|
|
</div>
|