github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/directeurs/src/views/Retours.vue (about)

     1  <template>
     2    <v-container fluid class="px-4">
     3      <v-dialog v-model="showAverage">
     4        <v-card>
     5          <v-card-title>
     6            Moyenne des avis
     7          </v-card-title>
     8          <v-card-text>
     9            <satisfactions :satisfactions="averages"></satisfactions>
    10          </v-card-text>
    11        </v-card>
    12      </v-dialog>
    13  
    14      <v-card class="py-1" color="secondary">
    15        <v-card-title>
    16          <v-row no-gutters>
    17            <v-col>Avis sur le séjour</v-col>
    18            <v-col class="text-right">
    19              <tooltip-btn
    20                tooltip="Afficher la moyenne des avis"
    21                icon
    22                @click="showAverage = true"
    23                :disabled="sondages.length == 0"
    24              >
    25                <v-icon>{{ $icons["mdi-poll"] }}</v-icon>
    26              </tooltip-btn>
    27            </v-col>
    28          </v-row>
    29        </v-card-title>
    30        <v-card-subtitle
    31          >Retours exprimés depuis les espaces de suivis</v-card-subtitle
    32        >
    33        <retour
    34          v-for="(sondage, i) in sondages"
    35          :key="i"
    36          :sondage="sondage"
    37        ></retour>
    38      </v-card>
    39    </v-container>
    40  </template>
    41  
    42  <script lang="ts">
    43  import Vue from "vue";
    44  import Component from "vue-class-component";
    45  import { C } from "@/logic/controller";
    46  import Retour from "@/components/retours/Retour.vue";
    47  import { Sondage } from "../logic/types";
    48  import TooltipBtn from "../components/TooltipBtn.vue";
    49  import Satisfactions from "../components/retours/Satisfactions.vue";
    50  import { average } from "../components/retours/satisfactions";
    51  
    52  const RetoursProps = Vue.extend({
    53    props: {}
    54  });
    55  
    56  @Component({
    57    components: { Retour, TooltipBtn, Satisfactions }
    58  })
    59  export default class Retours extends RetoursProps {
    60    showAverage = false;
    61    C = C;
    62    sondages: Sondage[] = [];
    63  
    64    get averages() {
    65      return average(this.sondages);
    66    }
    67  
    68    async created() {
    69      const out = await C.loadSondages();
    70      if (out === undefined) return;
    71      this.sondages = out;
    72    }
    73  }
    74  </script>
    75  
    76  <style scoped></style>