Add start live survey button on responses page
This commit is contained in:
parent
376a059541
commit
a5183bc511
4 changed files with 47 additions and 21 deletions
31
ui/src/components/StartStopLiveSurvey.svelte
Normal file
31
ui/src/components/StartStopLiveSurvey.svelte
Normal file
|
@ -0,0 +1,31 @@
|
|||
<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}
|
Reference in a new issue