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

     1  <template>
     2    <v-container fluid>
     3      <v-dialog v-model="showInfo" max-width="800px">
     4        <v-card>
     5          <v-card-title>Message du participant</v-card-title>
     6          <v-card-text>
     7            {{ info }}
     8          </v-card-text>
     9        </v-card>
    10      </v-dialog>
    11  
    12      <v-toolbar dense>
    13        <v-menu open-on-hover bottom offset-y>
    14          <template v-slot:activator="{ on }">
    15            <v-btn v-on="on" icon>
    16              <v-icon>{{ $icons["mdi-information-outline"] }}</v-icon>
    17            </v-btn>
    18          </template>
    19          <v-card>
    20            <v-card-text>
    21              <b>{{ nbInscrits }}</b> inscrit(s)
    22              <br />
    23              <span :style="{ color: COULEUR_ATTENTE }">
    24                <b>{{ nbAttente }}</b> en liste d'attente
    25              </span>
    26              <br />
    27              <v-tooltip bottom>
    28                <template v-slot:activator="{ on }">
    29                  <span v-on="on" :style="{ color: COULEUR_ANNIVERSAIRE }">
    30                    <b>{{ anniversaires.length }}</b> anniversaire(s) pendant le
    31                    séjour
    32                  </span>
    33                </template>
    34                {{ anniversaires.join(", ") }}
    35              </v-tooltip>
    36              <br />
    37              <span :style="{ color: COULEUR_INFO }">
    38                <b>{{ nbInfos }}</b> information(s) particulière(s)
    39              </span>
    40            </v-card-text>
    41          </v-card>
    42        </v-menu>
    43        <v-toolbar-title>Inscrits</v-toolbar-title>
    44        <v-spacer></v-spacer>
    45        <v-toolbar-items>
    46          <tooltip-btn
    47            tooltip="Export au format Excel des inscrits..."
    48            @click="downloadListe"
    49            text
    50            small
    51          >
    52            <v-icon class="mr-1">{{ $icons["mdi-download"] }}</v-icon>
    53            Exporter
    54          </tooltip-btn>
    55          <!-- Export rapides des mails -->
    56          <v-menu>
    57            <template v-slot:activator="{ on: menu }">
    58              <v-tooltip bottom>
    59                <template v-slot:activator="{ on: tooltip }">
    60                  <v-btn v-on="{ ...tooltip, ...menu }" depressed>Mails</v-btn>
    61                </template>
    62                Envoyer un mail aux inscrits...
    63              </v-tooltip>
    64            </template>
    65            <v-list>
    66              <v-list-item>
    67                <v-list-item-content>
    68                  <a :href="mailToInscrits"
    69                    >Mail aux inscrits (sans liste d'attente)</a
    70                  >
    71                </v-list-item-content>
    72                <v-list-item-action>
    73                  <tooltip-btn
    74                    tooltip="Copier les adresses"
    75                    @click="copyMailsToClipboard()"
    76                    icon
    77                  >
    78                    <v-icon>{{ $icons["mdi-content-copy"] }} </v-icon>
    79                  </tooltip-btn>
    80                </v-list-item-action>
    81              </v-list-item>
    82            </v-list>
    83          </v-menu>
    84        </v-toolbar-items>
    85      </v-toolbar>
    86      <v-data-table
    87        dense
    88        :items="items"
    89        :headers="headers"
    90        hide-default-footer
    91        fixed-header
    92        height="68vh"
    93        :items-per-page="9999"
    94        class="mt-2"
    95      >
    96        <template v-slot:[`item.info`]="{ item }">
    97          <tooltip-btn
    98            tooltip="Afficher les informations du participant"
    99            small
   100            icon
   101            v-if="asI(item).info != ''"
   102            :color="COULEUR_INFO"
   103            @click="
   104              info = asI(item).info;
   105              showInfo = true;
   106            "
   107          >
   108            <v-icon>{{ $icons["mdi-email"] }}</v-icon>
   109          </tooltip-btn>
   110        </template>
   111  
   112        <template v-slot:[`item.nom`]="{ item }">
   113          <span
   114            :style="{
   115              color: asI(item).is_attente ? COULEUR_ATTENTE : ''
   116            }"
   117          >
   118            {{ asI(item).nom }}
   119          </span>
   120        </template>
   121        <template v-slot:[`item.prenom`]="{ item }">
   122          <span
   123            :style="{
   124              color: asI(item).is_attente ? COULEUR_ATTENTE : ''
   125            }"
   126          >
   127            {{ asI(item).prenom }}
   128          </span>
   129        </template>
   130  
   131        <template v-slot:[`item.date_naissance`]="{ item }">
   132          <v-tooltip bottom :disabled="!asI(item).has_anniversaire">
   133            <template v-slot:activator="{ on }">
   134              <span
   135                v-on="on"
   136                :style="{
   137                  color: asI(item).has_anniversaire ? COULEUR_ANNIVERSAIRE : '',
   138                  fontWeight: asI(item).has_anniversaire ? 'bold' : ''
   139                }"
   140              >
   141                {{ fmt.date(asI(item).date_naissance) }}
   142              </span>
   143            </template>
   144            {{ asI(item).prenom }} a son <b>anniversaire</b> pendant le séjour.
   145          </v-tooltip>
   146        </template>
   147  
   148        <template v-slot:[`item.sexe`]="{ item }">
   149          {{ fmt.sexe(asI(item).sexe) }}
   150        </template>
   151      </v-data-table>
   152    </v-container>
   153  </template>
   154  
   155  <script lang="ts">
   156  import Component from "vue-class-component";
   157  import TooltipBtn from "@/components/TooltipBtn.vue";
   158  import { C } from "@/logic/controller";
   159  
   160  import { BaseInscrits } from "@/views/inscrits";
   161  import { Inscrit } from "../logic/types";
   162  
   163  @Component({
   164    components: { TooltipBtn }
   165  })
   166  export default class InscritsSimples extends BaseInscrits {
   167    showInfo = false;
   168    info = "";
   169  
   170    headers: {
   171      text: string;
   172      value: keyof Inscrit;
   173      sortable?: boolean;
   174      width?: string;
   175    }[] = [
   176      {
   177        text: "",
   178        value: "info",
   179        sortable: false,
   180        width: "30px"
   181      },
   182      { text: "Nom", value: "nom" },
   183      { text: "Prénom", value: "prenom" },
   184      { text: "Sexe", value: "sexe" },
   185      { text: "Date de naissance", value: "date_naissance" },
   186      { text: "Mail", value: "mail" }
   187    ];
   188  
   189    get items(): Inscrit[] {
   190      return C.inscrits;
   191    }
   192  
   193    created() {
   194      C.getInscrits();
   195    }
   196  
   197    async downloadListe() {
   198      const name = await C.export("inscrits", {});
   199      if (name !== undefined) {
   200        C.notifications.success = "Liste téléchargée avec succès.";
   201      }
   202    }
   203  }
   204  </script>
   205  
   206  <style scoped></style>