From 72e38d59b1d655e902ae0fc7e864fe277620a0a8 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 26 Mar 2018 13:23:32 +0200 Subject: [PATCH] [webpack.teacher] updated fields names + pdf download works [scss.container.card] added PDF download icon --- webpack/component/teacher/view.vue | 5 +++-- webpack/data/teacher.js | 34 ++++++++++++++++++++++++++++ webpack/scss/container/card.scss | 36 ++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/webpack/component/teacher/view.vue b/webpack/component/teacher/view.vue index 674b6fa..4ea460b 100644 --- a/webpack/component/teacher/view.vue +++ b/webpack/component/teacher/view.vue @@ -93,12 +93,13 @@
{{ prof.equiTD }} - heures prévues + HETD
-
{{ prof.VHCours + prof.VHTd + prof.VHTp }}h réelles prévues
+
{{ prof.VHCours + prof.VHTd + prof.VHTp }}h présentielles
+
fiche
{{ gstore.edit_err }}
diff --git a/webpack/data/teacher.js b/webpack/data/teacher.js index c1c0782..4b541c1 100644 --- a/webpack/data/teacher.js +++ b/webpack/data/teacher.js @@ -657,4 +657,38 @@ gstore.add('ia_handler', function(prof_i){ }); +}); + + + + + +/* (9) Manage instant download fiche +---------------------------------------------------------*/ +/* (1) Define download handler */ +gstore.add('id_handler', function(prof_id){ + + /* (1) Abort if wrong prof_id */ + if( prof_id == null || isNaN(prof_id) ) + return; + + /* (2.1) Find index in gstore */ + var gi = gstore.get.professors.map( (data, i) => { return ( data.idProfesseur && data.idProfesseur == prof_id ) ? i : ''; }).join(''); + + /* (2.2) Exit if not found */ + if( isNaN(gi) ) return; + var local = gstore.get.professors[gi]; + + /* (3.1) Update in database */ + api.call(`GET professor/pdf/${local.idProfesseur}`, {}, function(rs){ + + /* (3.1.1) Abort on error */ + if( rs.error !== 0 || rs.link == null ) + return console.log('Impossible de télécharger la fiche, erreur '+rs.error); + + /* (3.1.2) Success */ + document.location = rs.link; + + }); + }); \ No newline at end of file diff --git a/webpack/scss/container/card.scss b/webpack/scss/container/card.scss index 4d496f7..566d165 100644 --- a/webpack/scss/container/card.scss +++ b/webpack/scss/container/card.scss @@ -541,6 +541,42 @@ } + /* (8) Card sub */ + & > div.pdfdl{ + + display: inline-block; + margin-top: 1em; + + color: lighten($primary-color, 20%); + + transition: color .1s ease-in-out; + + cursor: pointer; + + &:before{ + content: ''; + + display: inline-block; + position: relative; + top: .2em; + width: 1em; + height: 1em; + + margin-right: .5em; + + background: url('/asset/svg/fiche.svg@#{$menu-item-inactive}') center center no-repeat; + background-size: contain; + + } + &:hover{ + + color: #333; + + &:before{ background-image: url('/asset/svg/fiche.svg@ea4C3a'); } + } + + } + }