github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/directeurs/src/components/inscrits/PanelInfosParticulieres.vue (about) 1 <template> 2 <v-card> 3 <v-card-title> 4 <v-row no-gutters> 5 <v-col>Infos particulières</v-col> 6 <v-col class="text-right"> 7 <tooltip-btn tooltip="Copier" @click="copyToClipboard" icon> 8 <v-icon>{{ $icons["mdi-content-copy"] }} </v-icon> 9 </tooltip-btn> 10 </v-col> 11 </v-row> 12 </v-card-title> 13 <v-card-text> 14 <v-card shaped v-for="(dossier, i) in infos" :key="i" class="my-2"> 15 <v-card-subtitle class="py-2"> 16 <v-row no-gutters> 17 <v-col class="font-weight-bold"> 18 {{ labelResponsable(dossier.responsable) }} 19 </v-col> 20 <v-col class="text-right"> 21 {{ labelInscrits(dossier.participants) }} 22 </v-col> 23 </v-row> 24 </v-card-subtitle> 25 <v-card-text> 26 <v-card 27 v-for="(message, i) in dossier.messages" 28 :key="i" 29 :color="color(message.kind)" 30 > 31 <v-card-text class="pa-2"> 32 <div v-for="(line, i) in message.contenu.split('\n')" :key="i"> 33 {{ line }} 34 </div> 35 </v-card-text> 36 </v-card> 37 </v-card-text> 38 </v-card> 39 </v-card-text> 40 </v-card> 41 </template> 42 43 <script lang="ts"> 44 import Vue from "vue"; 45 import Component from "vue-class-component"; 46 import { DossierMessages, C } from "../../logic/controller"; 47 import { MessageKind, Responsable, Inscrit } from "../../logic/types"; 48 import { COULEUR_INFO } from "../../views/inscrits"; 49 import { Formatter } from "../../logic/formatter"; 50 import TooltipBtn from "@/components/TooltipBtn.vue"; 51 52 const PanelInfosParticulieresProps = Vue.extend({ 53 props: { 54 infos: Array as () => DossierMessages[] 55 } 56 }); 57 @Component({ 58 components: { TooltipBtn } 59 }) 60 export default class PanelInfosParticulieres extends PanelInfosParticulieresProps { 61 fmt = Formatter; 62 63 color(kind: MessageKind) { 64 if (kind == MessageKind.MCentre) return "green"; 65 if (kind == MessageKind.MResponsable) return COULEUR_INFO; 66 return ""; 67 } 68 69 labelResponsable(resp: Responsable) { 70 return Formatter.nomPrenom(resp); 71 } 72 73 labelInscrits(inscrits: Inscrit[]) { 74 return inscrits.map(i => i.prenom).join(", "); 75 } 76 77 copyToClipboard() { 78 C.exportInfosToClipboard(this.infos); 79 } 80 } 81 </script> 82 83 <style scoped></style>