github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/bv/src/pages/espace_perso/components/documents/DocumentsCamp.vue (about) 1 <template> 2 <b-card class="mt-3"> 3 <template v-slot:header> 4 <b-row> 5 <b-col class="col"> 6 <b> 7 {{ names }} 8 </b> 9 </b-col> 10 <b-col class="text-fushia text-right"> 11 <i> 12 {{ campLabel }} 13 </i> 14 </b-col> 15 </b-row> 16 </template> 17 <b-card-text> 18 <b-list-group flush> 19 <b-list-group-item v-for="(document, i) in documents" :key="i"> 20 <document 21 :controller="controller" 22 :document="document" 23 hideUpload 24 hideDelete 25 ></document> 26 </b-list-group-item> 27 <b-list-group-item class="my-2" v-if="documents.length == 0"> 28 <i>Aucun document n'est encore disponible pour ce camp.</i> 29 </b-list-group-item> 30 </b-list-group> 31 </b-card-text> 32 </b-card> 33 </template> 34 35 <script lang="ts"> 36 import Vue from "vue"; 37 import Component from "vue-class-component"; 38 import Document from "../../../../shared/Document.vue"; 39 40 import { CampPlus } from "@/shared/logic/types"; 41 import { C } from "../../logic/controller"; 42 import { ControllerDocument } from "../../../../shared/logic/controller"; 43 44 const DocumentsCampProps = Vue.extend({ 45 props: { 46 camp: Object as () => CampPlus 47 } 48 }); 49 50 @Component({ 51 components: { Document } 52 }) 53 export default class DocumentsCamp extends DocumentsCampProps { 54 controller: ControllerDocument = C; 55 56 get names() { 57 return this.personnes() 58 .map(pers => pers.nom_prenom) 59 .join(", "); 60 } 61 get campLabel() { 62 return this.camp.label; 63 } 64 get documents() { 65 return this.camp.documents || []; 66 } 67 68 private personnes() { 69 return C.data.participants 70 .filter(part => part.id_camp == this.camp.id) 71 .map(part => C.getPersonne(part)); 72 } 73 } 74 </script> 75 76 <style scoped></style>