ptut-vhost/webpack/component/teacher/view.vue

169 lines
6.6 KiB
Vue

<template>
<div id='CONTAINER' class='card'>
<div class='card filter'>
<div v-for='(filter_grp, gname) in gstore.filters' :title='gname' data-unblur-filter>
<div class='fold-toggle' :data-show='gstore.filters[gname][0].visible?1:0' @click='gstore.show_fgroup(gname)' :data-count='gstore.filters[gname][0].active.length' data-unblur-filter>{{ gname }}</div>
<div class='fold' data-unblur-filter>
<span v-for='(data, i) in filter_grp' v-if='i > 0' :class="data.active == true ? 'active' : ''" @click='gstore.toggle_filter(gname, i); gstore.filter_handler(gname);' :title='data.code' data-unblur-filter>{{ data.name }}</span>
</div>
</div>
</div>
<div class='card container'>
<input class='card instant-search neutral' type='text' @keyup='gstore.is_handler($event)' placeholder='Recherche instantannée' id='teacher_view_instant_search'>
<button class='card toggle valid' :data-active='gstore.create_card?1:0' @click='gstore.create_card=!gstore.create_card' title='Créer un enseignant'>+</button>
<section class='valid' data-create='' v-show='gstore.create_card'>
<select class='category' v-model='gstore.create_cat'>
<option selected='selected' disabled='disabled' value='-'>Catégorie d'enseignant</option>
<option v-for='cat in gstore.categories' :value='cat.idCategorie'>{{ cat.labelCategorie }}</option>
</select>
<h1>
<input type='text' placeholder='Prénom Nom' v-model='gstore.create_name'>
<span data-visible='1'>(<input type='text' placeholder='identifiant' v-model='gstore.create_cas'>)</span>
</h1>
<div class='table'>
<div title='équivalents TD'>
<span>0</span>
<span>HETD</span>
</div>
<div>
<span><input type='text' placeholder='???' v-model='gstore.create_h'></span>
<span>heures à faire</span>
</div>
</div>
<div :class="gstore.create_err.length > 0 ? 'sub warning' : 'sub'" :data-valid='gstore.create_err_valid?1:0'>{{ gstore.create_err }}</div>
<div class='footer'>
<button class='valid' @click='gstore.ic_handler()'>Créer l'enseignant</button>
<button class='neutral' @click='gstore.ic_reset(); gstore.create_card=false'>Annuler</button>
</div>
</section>
<section v-if='gstore.professors.length <= 0' data-anim='0'>Aucun enseignant trouvé</section>
<section v-for='(prof, pi) in gstore.professors'
:class="gstore.edit_i==pi ? 'search' : ''"
:data-id='prof.idProfesseur'
:data-category='prof.idCat'
:data-lname='prof.lastName'
:data-fname='prof.firstName'>
<!-- if VIEW MODE -->
<div class='goo-menu' v-show='gstore.edit_i!=pi'>
<div class='admin' :data-admin='prof.idProfesseur' :data-active='prof.admin?1:0' title='Admin' @click="gstore.ia_handler(pi)"></div>
<div class='remove' :data-remove='prof.idProfesseur' title='Supprimer' @click="gstore.ir_handler(prof.idProfesseur)"></div>
<div class='edit' :data-edit='prof.idProfesseur' title='Modifier' @click="gstore.ie_toggle(pi)"></div>
</div>
<!-- if VIEW MODE -->
<span v-show='gstore.edit_i!=pi' class='category'>{{ prof.categorie }}</span>
<!-- if EDIT MODE -->
<select v-show='gstore.edit_i==pi' v-model='gstore.edit_cat' class='category'>
<option selected='selected' disabled='disabled' value='-'>Catégorie d'enseignant</option>
<option v-for='cat in gstore.categories' :value='cat.idCategorie'>{{ cat.labelCategorie }}</option>
</select>
<!-- endif -->
<!-- if VIEW MODE -->
<h1 v-show='gstore.edit_i!=pi' :class="prof.hoursToDo > prof.equiTD ? 'warning' : ''" :title="prof.hoursToDo > prof.equiTD ? 'Attention: heures manquantes' : ''">{{ prof.firstName }} {{ prof.lastName }} <span :data-visible='prof.casLogin.length'>({{ prof.casLogin }})</span></h1>
<!-- if EDIT MODE -->
<h1 v-show='gstore.edit_i==pi' :class="prof.hoursToDo > prof.equiTD ? 'warning' : ''">
<input type='text' placeholder='Prénom Nom' v-model='gstore.edit_name'>
<span data-visible='1'>(<input type='text' placeholder='identifiant' v-model='gstore.edit_cas'>)</span>
</h1>
<!-- endif -->
<div class='table'>
<div title='équivalents TD'>
<span>{{ prof.equiTD }}</span>
<span>HETD</span>
</div>
<!-- if EDIT MODE -->
<div v-show='gstore.edit_i==pi'>
<span><input type='text' placeholder='???' v-model='gstore.edit_h'></span>
<span>heures à faire</span>
</div>
<!-- endif -->
<div title='heures de décalage' v-show='gstore.edit_i!=pi'>
<span :data-error='prof.equiTD < prof.hoursToDo?1:0' :data-success='prof.equiTD < prof.hoursToDo?0:1'>{{ Math.floor( (prof.equiTD < prof.hoursToDo ? prof.hoursToDo-prof.equiTD : prof.equiTD-prof.hoursToDo)*100 )/100 }}</span>
<span>{{ prof.equiTD < prof.hoursToDo ? 'sous-service' : 'sur-service' }}</span>
</div>
</div>
<!-- if VIEW MODE -->
<div v-show='gstore.edit_i!=pi' class='pdfdl' title='Télécharger la fiche' @click='gstore.id_handler(prof.idProfesseur)'>fiche</div>
<!-- if EDIT MODE -->
<div v-show='gstore.edit_i==pi' :class="gstore.edit_err.length > 0 ? 'sub warning' : 'sub'" :data-valid='gstore.edit_err_valid?1:0'>{{ gstore.edit_err }}</div>
<!-- endif -->
<div class='footer'>
<!-- if VIEW MODE -->
<span v-show='gstore.edit_i!=pi' :class="(prof.VHCours == 0) ? 'course' : 'course active'">{{ prof.VHCours }}h <span>CM</span></span>
<hr v-show='gstore.edit_i!=pi'>
<span v-show='gstore.edit_i!=pi' :class="(prof.VHTd == 0) ? 'td' : 'td active'" >{{ prof.VHTd }}h <span>TD</span></span>
<hr v-show='gstore.edit_i!=pi'>
<span v-show='gstore.edit_i!=pi' :class="(prof.VHTp == 0) ? 'tp' : 'tp active'" >{{ prof.VHTp }}h <span>TP</span></span>
<!-- if EDIT MODE -->
<button v-show='gstore.edit_i==pi' class='search' @click='gstore.ie_handler(pi)'>Modifier l'enseignant</button>
<button v-show='gstore.edit_i==pi' class='grey' @click='gstore.ie_toggle(-1)'>Annuler</button>
<!-- endif -->
</div>
<div class='info'>
<strong>{{ prof.hoursToDo }}h</strong> à faire, <strong>{{ prof.VHCours + prof.VHTd + prof.VHTp }}h</strong> présentielles
</div>
</section>
</div>
</div>
</template>
<script>
export default {
name: 'CONTAINER_VIEW',
data(){
return { gstore: gstore.get }
},
beforeMount(){
// set onblur to hide filter
window.onblur.link('teacher.filter', (e) => {
// ignore [data-unblur-filter] elements
if( e.target.getAttribute('data-unblur-filter') !== null )
return;
// else: hide
gstore.get.show_fgroup(-1);
});
}
}
</script>