diff --git a/atsebayt/src/components/SurveyAdmin.svelte b/atsebayt/src/components/SurveyAdmin.svelte index 0ab89cc..c0148e5 100644 --- a/atsebayt/src/components/SurveyAdmin.svelte +++ b/atsebayt/src/components/SurveyAdmin.svelte @@ -3,6 +3,7 @@ import { goto } from '$app/navigation'; import { getQuestions } from '../lib/questions'; + import { ToastsStore } from '../stores/toasts'; const dispatch = createEventDispatcher(); export let survey = null; @@ -11,7 +12,9 @@ survey.save().then((response) => { dispatch('saved'); }, (error) => { - console.log(error) + ToastsStore.addErrorToast({ + msg: error.errmsg, + }); }) } @@ -19,7 +22,9 @@ survey.delete().then((response) => { goto(`surveys`); }, (error) => { - console.log(error) + ToastsStore.addErrorToast({ + msg: error.errmsg, + }); }) } @@ -27,7 +32,9 @@ survey.duplicate().then((response) => { goto(`surveys/${response.id}`); }).catch((error) => { - console.log(error) + ToastsStore.addErrorToast({ + msg: error.errmsg, + }); }) } diff --git a/atsebayt/src/components/SurveyBadge.svelte b/atsebayt/src/components/SurveyBadge.svelte index 2d87b5a..b224a82 100644 --- a/atsebayt/src/components/SurveyBadge.svelte +++ b/atsebayt/src/components/SurveyBadge.svelte @@ -4,7 +4,7 @@ export { className as class }; -{#if survey.direct}Direct +{#if survey.direct != null}Direct {:else if survey.startAvailability() > Date.now()}Prévu {:else if survey.endAvailability() > Date.now()}En cours {:else if !survey.corrected}Terminé diff --git a/atsebayt/src/components/SurveyList.svelte b/atsebayt/src/components/SurveyList.svelte index cd16519..0d8c415 100644 --- a/atsebayt/src/components/SurveyList.svelte +++ b/atsebayt/src/components/SurveyList.svelte @@ -12,7 +12,7 @@ req_surveys.then((surveys) => { for (const survey of surveys) { - if (survey.direct) { + if (survey.direct != null) { direct = survey; } } @@ -39,7 +39,7 @@ {:then surveys}
{#each surveys as survey, sid (survey.id)} - {#if survey.shown && (!$user || (!$user.was_admin || $user.promo == survey.promo) || $user.is_admin)} + {#if (survey.shown || survey.direct != null) && (!$user || (!$user.was_admin || $user.promo == survey.promo) || $user.is_admin)} {#if $user && $user.is_admin && (sid == 0 || surveys[sid-1].promo != survey.promo)}