From b0dc13aa90d4b69c7bb1e348ffb70a391ce6f2c1 Mon Sep 17 00:00:00 2001
From: nicrausaz <n.crausaz99@gmail.com>
Date: Wed, 3 Jul 2019 11:09:41 +0200
Subject: [PATCH] Marqueur nouveau, image format

---
 .../src/components/application/mailDialog.vue | 26 +++++++++++++++++-
 .../application/sheets/filesDataSheet.vue     | 27 ++++++++++++++++---
 canapGEST/Site/src/views/ApplicationsView.vue | 22 ++++++++-------
 canapGEST/Site/src/views/OpenJobsView.vue     |  2 +-
 4 files changed, 61 insertions(+), 16 deletions(-)

diff --git a/canapGEST/Site/src/components/application/mailDialog.vue b/canapGEST/Site/src/components/application/mailDialog.vue
index e7dd555..10d0e77 100644
--- a/canapGEST/Site/src/components/application/mailDialog.vue
+++ b/canapGEST/Site/src/components/application/mailDialog.vue
@@ -14,7 +14,12 @@
           </v-flex>
           <v-layout wrap>
             <v-flex xs12 sm6>
-              <v-select :items="['Refus', 'Dossier incomplet']" label="Type de réponse" required></v-select>
+              <v-select
+                :items="['Refus', 'Dossier incomplet', 'Autre']"
+                label="Type de réponse"
+                v-model="mail.type"
+                @change="getMailText"
+              ></v-select>
             </v-flex>
           </v-layout>
           <v-flex xs12>
@@ -54,7 +59,13 @@ export default {
       mail: {
         to: '',
         subject: 'EPFL: Votre candidature',
+        type: '',
         content: ''
+      },
+      texts: {
+        incomplete: 'Dossier incomplet',
+        denied: 'Dossier refusé',
+        other: ''
       }
     }
   },
@@ -66,6 +77,19 @@ export default {
   methods: {
     sendMails () {
       this.$store.dispatch('moduleApplications/sendMails', this.mail).then(this.is_open = false)
+    },
+    getMailText () {
+      switch (this.mail.type) {
+        case 'Refus':
+          this.mail.content = this.texts.incomplete
+          break
+        case 'Dossier incomplet':
+          this.mail.content = this.texts.denied
+          break
+        case 'Autre':
+          this.mail.content = this.texts.other
+          break
+      }
     }
   }
 }
diff --git a/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue b/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue
index 60298fa..79b9dca 100644
--- a/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue
+++ b/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue
@@ -11,11 +11,11 @@
       >
         <v-list-tile-avatar>
           <img
-            src="@/assets/logo_pdf.png"
+            :src="getPicture(file.file_name)"
             height="75px"
             @click="getFile(file.file_id, file.file_name)"
             style="cursor: pointer;"
-          >
+          />
         </v-list-tile-avatar>
         <v-list-tile-content>
           <v-list-tile-title>
@@ -37,14 +37,33 @@
 </template>
 
 <script>
+import logoJpg from '../../../assets/logo_jpg.png'
+import logoPdf from '../../../assets/logo_pdf.png'
+import logoPng from '../../../assets/logo_png.png'
+
 export default {
   name: 'files-data-sheet',
   methods: {
-    getFile(id, name) {
+    getFile (id, name) {
       this.$store.dispatch('moduleApplications/getFile', { id: id, name: name })
     },
-    getAllFiles() {
+    getAllFiles () {
       this.$store.dispatch('moduleApplications/getAllFiles', { id: this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_id })
+    },
+    getPicture (filename) {
+      let ext = filename.split('.')[1]
+      switch (ext) {
+        case 'jpg':
+          return logoJpg
+        case 'pdf':
+          return logoPdf
+        case 'jpeg':
+          return logoJpg
+        case 'png':
+          return logoPng
+        default:
+          break
+      }
     }
   }
 }
diff --git a/canapGEST/Site/src/views/ApplicationsView.vue b/canapGEST/Site/src/views/ApplicationsView.vue
index 4c37a4a..4c3014e 100644
--- a/canapGEST/Site/src/views/ApplicationsView.vue
+++ b/canapGEST/Site/src/views/ApplicationsView.vue
@@ -2,7 +2,7 @@
   <div id="applications-view">
     <h1>Postulations</h1>
     <div>
-      <applicationsFilters/>
+      <applicationsFilters />
       <v-card-title v-if="hasSelected && $store.getters['moduleUser/userIsResponsible']">
         <div>
           Modifications groupées
@@ -28,6 +28,7 @@
         :search="$store.state.moduleApplications.filters.search"
       >
         <template v-slot:items="props">
+          <span></span>
           <tr>
             <td
               v-if="$store.getters['moduleUser/userIsResponsible']"
@@ -35,9 +36,7 @@
             >
               <v-checkbox v-model="props.selected" hide-details color="primary"></v-checkbox>
             </td>
-            <td
-              :class="{ isNew: isNew(props.item.fk_status, props.item.applicant_application_date) }"
-            >
+            <td :class="{ isNew: isNew(props.item.fk_status, props.item.applicant_application_date) && !$store.getters['moduleUser/userIsResponsible'] }">
               <v-tooltip bottom class="mr-2">
                 <template v-slot:activator="{ on }">
                   <v-icon big @click="navigateTo(props.item.applicant_id)" v-on="on">pageview</v-icon>
@@ -69,25 +68,25 @@
                 alt="logo_french"
                 width="18"
                 v-if="props.item.applicant_speaks_french"
-              >
+              />
               <img
                 src="@/assets/german_logo.png"
                 alt="logo_german"
                 width="18"
                 v-if="props.item.applicant_speaks_german"
-              >
+              />
               <img
                 src="@/assets/english_logo.png"
                 alt="logo_english"
                 width="18"
                 v-if="props.item.applicant_speaks_english"
-              >
+              />
               <img
                 src="@/assets/others_logo.png"
                 alt="logo_others"
                 width="18"
                 v-if="props.item.applicant_speaks_other"
-              >
+              />
             </td>
             <td>{{ props.item.applicant_scolarity_end }}</td>
             <td>{{ getFormatedDate(props.item.applicant_application_date) }}</td>
@@ -177,13 +176,16 @@ export default {
         this.$store.dispatch('moduleApplications/getApplications')
       }, 300)
     },
+    deleteOne (id) {
+      this.$store.dispatch('moduleApplications/deleteApplication', { id: id })
+    },
     deleteMultiple () {
       if (confirm('Voulez-vous vraiment supprimer les candidatures sélectionnées ? \n Cette action est irréversible.')) {
         this.selected.forEach(item => {
-          this.$store.dispatch('moduleApplications/deleteApplication', { id: item.applicant_id })
+          this.deleteOne(item.applicant_id)
         })
-        this.$store.dispatch('moduleApplications/getApplications')
       }
+      setTimeout(() => { this.$store.dispatch('moduleApplications/getApplications') }, 300)
     },
     toggleMailDialog () {
       this.mail_dialog_opened = !this.mail_dialog_opened
diff --git a/canapGEST/Site/src/views/OpenJobsView.vue b/canapGEST/Site/src/views/OpenJobsView.vue
index 60b13ee..1ef8a6e 100644
--- a/canapGEST/Site/src/views/OpenJobsView.vue
+++ b/canapGEST/Site/src/views/OpenJobsView.vue
@@ -64,7 +64,7 @@
                         multiple
                         small-chips
                       ></v-combobox>
-                      <small>Pour ajouter un groupe non-existant, entrer sa valeur puis touche "Enter"</small>
+                      <small>Pour ajouter un groupe non-existant, entrer sa valeur puis "Enter"</small>
                     </v-flex>
                     <v-flex xs12 sm6>
                       <v-text-field
-- 
GitLab