mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-10 23:39:43 +00:00
add/remove evaluation from evaluation list
This commit is contained in:
@@ -1,35 +1,13 @@
|
||||
<template>
|
||||
affiche les évaluations
|
||||
<div v-if="hasEvaluation" class="addEvaluation">
|
||||
<div v-if="hasEvaluation">
|
||||
|
||||
<p v-if="pickedEvaluations.length === 0" class="chill-no-data-statement">
|
||||
{{ $t('no_evaluation_associated') }}
|
||||
</p>
|
||||
|
||||
<ul class="list-evaluations">
|
||||
<li v-for="e in pickedEvaluations" class="badge bg-primary" @click="removeEvaluation(e)">
|
||||
<div>
|
||||
<div v-for="e in pickedEvaluations" class="evaluation-title" @click="removeEvaluation(e)">
|
||||
<i class="fa fa-times"></i>
|
||||
{{ e.id }}
|
||||
</li>
|
||||
<template v-if="isExpanded">
|
||||
<li v-for="e in availableForCheckEvaluations" class="badge bg-primary" @click="addEvaluation(e)">
|
||||
<i class="fa fa-plus"></i>
|
||||
{{ e.id }}
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
actions
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div v-if="!hasEvaluation" class="noEvaluation">
|
||||
<div class="chill-no-data-statement">
|
||||
{{ $t('evaluation_has_no_evaluation') }}
|
||||
{{ e.evaluation.title.fr }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -46,40 +24,23 @@ const i18n = {
|
||||
|
||||
export default {
|
||||
name: "AddEvaluation",
|
||||
props: ['availableEvaluations'],
|
||||
props: [],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hasEvaluation() {
|
||||
return this.$store.state.evaluationsForAction.length > 0;
|
||||
return this.$store.state.evaluationsPicked.length > 0;
|
||||
},
|
||||
pickedEvaluations() {
|
||||
return this.$store.state.evaluationsPicked;
|
||||
},
|
||||
availableForCheckEvaluations() {
|
||||
|
||||
let pickedIds = this.$store.state.evaluationsPicked.map(e => e.id);
|
||||
////console.log('picked ids', pickedIds);
|
||||
|
||||
return this.$store.state.evaluationsForAction.filter(e => !pickedIds.includes(e.id));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleSelect() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
},
|
||||
addEvaluation(e) {
|
||||
////console.log('addEvaluation', e);
|
||||
this.$store.commit('addEvaluationPicked', e);
|
||||
return;
|
||||
},
|
||||
removeEvaluation(e) {
|
||||
////console.log('removeEvaluation', e);
|
||||
this.$store.commit('removeEvaluationPicked', e);
|
||||
this.$store.commit('removeEvaluation', e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<template>
|
||||
affiche le formulaire
|
||||
<!--
|
||||
<div>
|
||||
<h3>
|
||||
{{ $t('evaluation_title') }}
|
||||
@@ -19,6 +21,7 @@
|
||||
{{ $t('evaluation_add_a_document') }}
|
||||
{{ $t('evaluation_add') }}
|
||||
</pre>
|
||||
-->
|
||||
</template>
|
||||
|
||||
<script>
|
Reference in New Issue
Block a user