This commit is contained in:
parent
1252d8f814
commit
92f563e38c
@ -9,7 +9,6 @@
|
||||
|
||||
export let cts = null;
|
||||
export let filter = "";
|
||||
export let hilights = "";
|
||||
export let question = null;
|
||||
export let proposals = null;
|
||||
export let notCorrected = false;
|
||||
|
@ -138,37 +138,5 @@
|
||||
{survey}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if false}
|
||||
<div ng-controller="ProposalsController" ng-if="question.kind == 'ucq' || question.kind == 'mcq'">
|
||||
<div class="form-group form-check" ng-if="!question.edit && question.kind == 'mcq'" ng-repeat="proposal in proposals">
|
||||
<input type="checkbox" class="form-check-input" id="p{proposal.id}" ng-model="question['p' + proposal.id]" disabled={readonly}>
|
||||
<label class="form-check-label" for="p{proposal.id}">{proposal.label}</label>
|
||||
</div>
|
||||
<div class="form-group form-check" ng-if="!question.edit && question.kind == 'ucq'" ng-repeat="proposal in proposals">
|
||||
<input type="radio" class="form-check-input" name="proposals{question.id}" id="p{proposal.id}" ng-model="question.value" value="{proposal.id}" disabled={survey.readonly}>
|
||||
<label class="form-check-label" for="p{proposal.id}">{proposal.label}</label>
|
||||
</div>
|
||||
<div class="form-group row" ng-if="question.edit" ng-repeat="proposal in proposals">
|
||||
<div class="col">
|
||||
<input type="text" class="form-control" id="pi{proposal.id}" placeholder="Label" ng-model="proposal.label">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button type="button" class="btn btn-success ml-1" ng-click="saveProposal()" ng-if="question.edit && (question.kind == 'ucq' || question.kind == 'mcq')"><i class="bi bi-check" ></i></button>
|
||||
<button type="button" class="btn btn-danger ml-1" ng-click="deleteProposal()" ng-if="question.edit && (question.kind == 'ucq' || question.kind == 'mcq')"><i class="bi bi-trash-fill"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-info ml-1" ng-click="addProposal()" ng-if="question.edit && (question.kind == 'ucq' || question.kind == 'mcq')" ng-disabled="!question.id"><i class="bi bi-plus"></i> Ajouter des proposals
|
||||
</button><span ng-show="question.edit && (question.kind == 'ucq' || question.kind == 'mcq') && !question.id" class="ml-2" style="font-style:italic"> Créez la question pour ajouter des propositions</span>
|
||||
</div>
|
||||
<div class="ml-3 card-text alert alert-success" ng-if="!question.edit && (question.response.score_explaination || question.response.score)">
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<strong>{question.response.score} %</strong>
|
||||
</div>
|
||||
<p class="col mb-0" style="white-space: pre-line">{question.response.score_explaination}</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -63,17 +63,18 @@
|
||||
<DateFormat date={survey.end_availability} dateStyle="medium" timeStyle="medium" />
|
||||
</td>
|
||||
{/if}
|
||||
{#if !$user}
|
||||
{:else if !survey.corrected}
|
||||
<td>N/A</td>
|
||||
{:else}
|
||||
<td>
|
||||
{#await getScore(survey)}
|
||||
<div class="spinner-border spinner-border-sm" role="status"></div>
|
||||
{:then score}
|
||||
{score.score}
|
||||
{/await}
|
||||
</td>
|
||||
{#if $user}
|
||||
{#if !survey.corrected}
|
||||
<td>N/A</td>
|
||||
{:else}
|
||||
<td>
|
||||
{#await getScore(survey)}
|
||||
<div class="spinner-border spinner-border-sm" role="status"></div>
|
||||
{:then score}
|
||||
{score.score}
|
||||
{/await}
|
||||
</td>
|
||||
{/if}
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
|
@ -51,7 +51,7 @@
|
||||
<SurveyBadge class="ms-2" {survey} />
|
||||
</div>
|
||||
|
||||
{#if $user.is_admin && edit}
|
||||
{#if $user && $user.is_admin && edit}
|
||||
<SurveyAdmin {survey} on:saved={() => edit = false} />
|
||||
{/if}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
<script lang="ts">
|
||||
<script>
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { user } from '../../stores/user';
|
||||
import SurveyAdmin from '../../components/SurveyAdmin.svelte';
|
||||
import SurveyBadge from '../../components/SurveyBadge.svelte';
|
||||
import SurveyQuestions from '../../components/SurveyQuestions.svelte';
|
||||
import { Survey } from '../../lib/surveys';
|
||||
import { getQuestions } from '../../lib/questions';
|
||||
|
||||
let survey = new Survey();
|
||||
</script>
|
||||
@ -19,6 +17,6 @@
|
||||
<SurveyBadge class="ms-2" {survey} />
|
||||
</div>
|
||||
|
||||
{#if $user.is_admin}
|
||||
{#if $user && $user.is_admin}
|
||||
<SurveyAdmin {survey} on:saved={(e) => { goto(`surveys/${e.detail.id}`)}} />
|
||||
{/if}
|
||||
|
Reference in New Issue
Block a user