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

     1  <template>
     2    <div>
     3      <v-dialog v-model="showDownloadOptions" max-width="400px">
     4        <v-card>
     5          <v-card-title class="headline"
     6            >Télécharger les fiches sanitaires</v-card-title
     7          >
     8          <v-card-text>
     9            <v-select
    10              :items="[
    11                {
    12                  value: 'all',
    13                  text: 'Archive avec fiches et vaccins'
    14                },
    15                {
    16                  value: 'all_in_one_document',
    17                  text: 'Document unique (sans les vaccins)'
    18                }
    19              ]"
    20              v-model="downloadOptions.mode"
    21              label="Type d'export"
    22            ></v-select>
    23            <div>
    24              <v-checkbox
    25                v-model="downloadOptions.only_mineurs"
    26                label="Sans les participants majeurs"
    27              ></v-checkbox>
    28            </div>
    29            <div v-if="downloadOptions.mode === 'all_in_one_document'">
    30              <v-checkbox
    31                v-model="downloadOptions.tri_groupe"
    32                label="Trier par groupe"
    33              ></v-checkbox>
    34            </div>
    35          </v-card-text>
    36          <v-card-actions>
    37            <v-spacer></v-spacer>
    38            <v-btn @click="downloadAll()" class="green--text">Télécharger</v-btn>
    39          </v-card-actions>
    40        </v-card>
    41      </v-dialog>
    42  
    43      <v-card>
    44        <v-toolbar class="toolbar-select">
    45          <v-toolbar-title>Fiches sanitaires</v-toolbar-title>
    46          <v-spacer></v-spacer>
    47          <v-toolbar-items>
    48            <v-select
    49              :items="filterOptions"
    50              v-model="filterFiches"
    51              label="Filtrer"
    52              clearable
    53              hide-details
    54            >
    55            </v-select>
    56            <v-divider vertical></v-divider>
    57            <tooltip-btn
    58              tooltip="Télécharger plusieurs fiches sanitaires et vaccins..."
    59              @click="showDownloadOptions = true"
    60              icon
    61            >
    62              <v-icon>{{ $icons["mdi-download"] }}</v-icon>
    63            </tooltip-btn>
    64          </v-toolbar-items>
    65        </v-toolbar>
    66        <v-data-table
    67          :headers="headers"
    68          :items="filteredItems"
    69          dense
    70          hide-default-footer
    71          :items-per-page="9999"
    72          fixed-header
    73          height="70vh"
    74          class="mt-2 px-1"
    75        >
    76          <template v-slot:[`item.nom_prenom`]="{ item }">{{
    77            fmt.nomPrenom(item)
    78          }}</template>
    79          <template v-slot:[`item.is_fiche_sanitaire_up_to_date`]="{ item }">
    80            <span
    81              :style="{
    82                color: colorUpTodate(item)
    83              }"
    84              >{{ fmt.bool(asI(item).is_fiche_sanitaire_up_to_date != -1) }}</span
    85            >
    86          </template>
    87          <template v-slot:[`item.document`]="{ item }">
    88            <div
    89              :style="{ color: colorDocument(item) }"
    90              v-if="hasFicheSanitaire(item) || hasVaccins(item)"
    91            >
    92              <span v-if="hasFicheSanitaire(item)">Fiche sanitaire</span>
    93              <span v-if="hasFicheSanitaire(item) && hasVaccins(item)">-</span>
    94              <span v-if="hasVaccins(item)"
    95                >{{ (item.vaccins || []).length }} vaccin(s)</span
    96              >
    97              <v-menu :close-on-content-click="false">
    98                <template v-slot:activator="{ on: menu }">
    99                  <v-tooltip bottom>
   100                    <template v-slot:activator="{ on: tooltip }">
   101                      <v-btn
   102                        width="30px"
   103                        height="30px"
   104                        v-on="{ ...menu, ...tooltip }"
   105                        icon
   106                        small
   107                      >
   108                        <v-icon>{{ $icons["mdi-view-list"] }}</v-icon>
   109                      </v-btn>
   110                    </template>
   111                    Télécharger un document...
   112                  </v-tooltip>
   113                </template>
   114                <v-list>
   115                  <v-list-item
   116                    v-if="hasFicheSanitaire(item)"
   117                    @click="downloadFicheSanitaire(item)"
   118                  >
   119                    <v-list-item-content>
   120                      <v-list-item-title>Fiche sanitaire</v-list-item-title>
   121                      <v-list-item-subtitle>
   122                        modifiée le
   123                        {{ fmt.date_heure(item.fiche_sanitaire.last_modif) }}
   124                      </v-list-item-subtitle>
   125                    </v-list-item-content>
   126                  </v-list-item>
   127                  <v-list-item
   128                    v-for="vaccin in item.vaccins"
   129                    :key="vaccin.id_crypted"
   130                    :href="vaccin.url_download"
   131                  >
   132                    <v-list-item-content>
   133                      <v-list-item-title
   134                        v-text="vaccin.nom_client"
   135                      ></v-list-item-title>
   136                      <v-list-item-subtitle>
   137                        modifiée le
   138                        {{ fmt.date_heure(vaccin.date_heure_modif) }}
   139                      </v-list-item-subtitle>
   140                    </v-list-item-content>
   141  
   142                    <v-list-item-avatar>
   143                      <v-img :src="vaccin.url_miniature"></v-img>
   144                    </v-list-item-avatar>
   145                  </v-list-item>
   146                </v-list>
   147              </v-menu>
   148            </div>
   149            <span v-else :style="{ color: colorDocument(item) }"
   150              >Aucun document</span
   151            >
   152          </template>
   153          <template v-slot:[`item.lien_fiche_sanitaire`]="{ item }">
   154            <v-btn :href="asI(item).lien_fiche_sanitaire" icon target="_blank">
   155              <v-icon>{{ $icons["mdi-link"] }}</v-icon>
   156            </v-btn>
   157          </template>
   158        </v-data-table>
   159      </v-card>
   160    </div>
   161  </template>
   162  
   163  <script lang="ts">
   164  import { FichesSanitaires } from "./FichesSanitaires";
   165  export default FichesSanitaires;
   166  </script>
   167  
   168  <style>
   169  .toolbar-select .v-input__control {
   170    margin: auto;
   171  }
   172  .toolbar-select .v-input__slot {
   173    height: 100%;
   174  }
   175  .toolbar-select .v-input {
   176    height: 100%;
   177  }
   178  </style>