ptut-vhost/webpack/component/ue/manage.vue

149 lines
4.6 KiB
Vue
Raw Normal View History

<template>
<div id='CONTAINER' class='list'>
<div class='list container' data-anim-incoming='1' :data-anim-bounce='gstore.nav_anim.out?1:0'>
<!-- <button @click='gstore.nav_out($router)'>Retour</button> -->
<!-- FILTERS -->
<section class='filter'>
<div>enseignant</div>
<div class='null'></div>
<div>volume horaire</div>
<div>formations</div>
</section>
<!-- COURS -->
<section class='cours'
v-for='(c,i) in gstore.manage.cours'
:data-id='c.idCours'>
<div class='icon' @click='gstore.rem(0, i)'></div>
<select v-model='c.new_prof' @change='gstore.upd_prof(0, i)'>
<option value='-1' v-show='c.idProf!=-1'>Aucun enseignant affecté</option>
<option v-for='p in gstore.manage.prof' :value='p.idProfesseur' v-show='p.idProfesseur!=c.idProf'>{{ `${p.firstName} ${p.lastName}` }}</option>
</select>
<div>Cours</div>
2018-03-18 15:31:03 +00:00
<div><span class='mono'>{{ c.volume }}</span> heures</div>
<div class='taglist'>
<div v-for='f in c.formations' data-action>
<span class='tag'>{{ gstore.form_by_id(f).labelForm || '???' }}</span>
<span data-remove @click='gstore.rem_form(0, i, f)'></span>
</div>
<div data-action>
<select class='tag' v-model='gstore.manage.cours[i].add_form'>
<option value='-' selected disabled>Ajouter</option>
<option
v-for='f in gstore.formations'
v-show='c.formations.indexOf(f.idForm) < 0'
:value='f.idForm'>{{ f.labelForm }}</option>
</select>
<span class='pointer' data-create @click='gstore.add_form(0, i)'></span>
</div>
</div>
</section>
<!-- TD -->
<section class='td'
v-for='(td,i) in gstore.manage.td'
:data-id='td.idTD'
data-anim-incoming='1'
:data-anim-bounce='gstore.nav_anim.out?1:0'>
<div class='icon' @click='gstore.rem(1, i)'></div>
<select v-model='td.new_prof' @change='gstore.upd_prof(1, i)'>
<option value='-1' v-show='td.idProf!=-1'>Aucun enseignant affecté</option>
<option v-for='p in gstore.manage.prof' :value='p.idProfesseur' v-show='p.idProfesseur!=td.idProf'>{{ `${p.firstName} ${p.lastName}` }}</option>
</select>
<div>TD</div>
2018-03-18 15:31:03 +00:00
<div><span class='mono'>{{ td.volume }}</span> heures</div>
<div class='taglist'>
<div v-for='f in td.formations' data-action>
<span class='tag'>{{ gstore.form_by_id(f).labelForm || '???' }}</span>
<span data-remove @click='gstore.rem_form(1, i, f)'></span>
</div>
<div data-action>
<select class='tag'v-model='gstore.manage.td[i].add_form'>
<option value='-' selected disabled>Ajouter</option>
<option
v-for='f in gstore.formations'
v-show='td.formations.indexOf(f.idForm) < 0'
:value='f.idForm'>{{ f.labelForm }}</option>
</select>
<span class='pointer' data-create @click='gstore.add_form(1, i)'></span>
</div>
</div>
</section>
<!-- TP -->
<section class='tp'
v-for='(tp,i) in gstore.manage.tp'
:data-id='tp.idTP'
data-anim-incoming='1'
:data-anim-bounce='gstore.nav_anim.out?1:0'>
<div class='icon' @click='gstore.rem(2, i)'></div>
<select v-model='tp.new_prof' @change='gstore.upd_prof(2, i)'>
<option value='-1' v-show='tp.idProf!=-1'>Aucun enseignant affecté</option>
<option v-for='p in gstore.manage.prof' :value='p.idProfesseur' v-show='p.idProfesseur!=tp.idProf'>{{ `${p.firstName} ${p.lastName}` }}</option>
</select>
<div>TP</div>
2018-03-18 15:31:03 +00:00
<div><span class='mono'>{{ tp.volume }}</span> heures</div>
<div class='taglist'>
<div v-for='f in tp.formations' data-action>
<span class='tag'>{{ gstore.form_by_id(f).labelForm || '???' }}</span>
<span data-remove @click='gstore.rem_form(2, i, f)'></span>
</div>
<div data-action>
<select class='tag' v-model='gstore.manage.tp[i].add_form'>
<option value='-' selected disabled>Ajouter</option>
<option
v-for='f in gstore.formations'
v-show='tp.formations.indexOf(f.idForm) < 0'
:value='f.idForm'>{{ f.labelForm }}</option>
</select>
<span class='pointer' data-create @click='gstore.add_form(2, i)'></span>
</div>
</div>
</section>
</div>
</div>
</template>
<script>
export default {
name: 'CONTAINER_VIEW',
data(){
return { gstore: gstore.get }
},
beforeMount(){
/* (1) Try to load data */
gstore.get.load_ue_groups(this.$route.params.code, 3).catch( (err) => { // try at max 3 times (200ms each) for UE to be loaded
/* (2) On error -> go to 'view' page */
gstore.get.router.push('/ue/view/');
});
}
}
</script>