31 lines
972 B
Svelte
31 lines
972 B
Svelte
<script>
|
|
import { createEventDispatcher } from 'svelte';
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
let className = '';
|
|
export { className as class };
|
|
|
|
export let survey = null;
|
|
</script>
|
|
|
|
{#if survey.direct !== null}
|
|
<a href="surveys/{survey.id}/live" class="btn btn-danger ms-1 float-end" title="Aller au direct"><i class="bi bi-film"></i></a>
|
|
<button
|
|
type="button"
|
|
class="btn btn-primary {className}"
|
|
title="Terminer le direct"
|
|
on:click={() => dispatch('end')}
|
|
>
|
|
<i class="bi bi-align-end"></i>
|
|
</button>
|
|
{:else}
|
|
<button
|
|
type="button"
|
|
class="btn btn-primary {className}"
|
|
title="Commencer le direct"
|
|
on:click={() => {survey.shown = true; survey.direct = 0; survey.start_availability = new Date(); survey.end_availability = new Date(Date.now() + 43200000); survey.save().then(() => dispatch('update'));}}
|
|
>
|
|
<i class="bi bi-align-start"></i>
|
|
</button>
|
|
{/if}
|