[webpack.teacher.view] CREATE feedback (green msg)

This commit is contained in:
xdrm-brackets 2018-03-07 14:43:04 +01:00
parent e818886972
commit f544959e76
3 changed files with 26 additions and 8 deletions

View File

@ -24,7 +24,7 @@
</div>
</div>
<div :class="gstore.create_err.length > 0 ? 'sub warning' : 'sub'">{{ gstore.create_err }}</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>
@ -39,9 +39,9 @@
:data-lname='prof.lastName'
:data-fname='prof.firstName'>
<div class='remove' :data-remove='prof.idProfesseur' @click="gstore.ir_handler($event.currentTarget.getAttribute('data-remove'))"></div>
<div class='edit' :data-edit='prof.idProfesseur' @click="gstore.ie_handler($event.currentTarget.getAttribute('data-edit'))"></div>
<div class='admin' :data-admin='prof.idProfesseur' :data-active='prof.admin' @click="gstore.ia_handler($event.currentTarget.getAttribute('data-admin'))"></div>
<div class='remove' :data-remove='prof.idProfesseur' @click="gstore.ir_handler($event.currentTarget.getAttribute('data-remove'))"></div>
<div class='edit' :data-edit='prof.idProfesseur' @click="gstore.ie_handler($event.currentTarget.getAttribute('data-edit'))"></div>
<div class='admin' :data-admin='prof.idProfesseur' :data-active='prof.admin?1:0' @click="gstore.ia_handler($event.currentTarget.getAttribute('data-admin'))"></div>
<span class='category'>{{ prof.categorie }}</span>
<h1 :class="prof.hoursToDo > prof.equiTD ? 'warning' : ''">{{ prof.firstName }} {{ prof.lastName }} <span :data-visible='prof.casLogin.length'>{{ prof.casLogin }}</span></h1>

View File

@ -216,6 +216,7 @@ gstore.add('create_cas', '');
gstore.add('create_h', '');
/* (2) Initialize error message */
gstore.add('create_err_valid', false);
gstore.add('create_err', '');
/* (3) Define create handler */
@ -265,10 +266,10 @@ gstore.add('ic_handler', function(prof_id){
/* (4.1) Création de la requête */
var rq = {
firstName: name[1],
lastName: name[0],
firstName: name[0],
lastName: name[1],
category: cat,
initials: name[1].substr(0,2)+name[0].substr(0,2),
initials: name[0].substr(0,2)+name[1].substr(0,2),
hoursToDo: hour,
isAdmin: false
};
@ -295,7 +296,20 @@ gstore.add('ic_handler', function(prof_id){
}
/* (4.2.3) Show that user is created */
console.log('Create')
// display all is ok
gstore.add('create_err_valid', true);
gstore.add('create_err', 'L\'enseignant a été créé, il s\'affichera au prochain rechargement');
// empty fields
gstore.get.create_cat = '-';
gstore.get.create_name = '';
gstore.get.create_cas = '';
gstore.get.create_h = '';
return setTimeout(() => {
gstore.add('create_err', '');
gstore.add('create_err_valid', false);
}, 2000);
});

View File

@ -549,6 +549,10 @@
background-image: url('/asset/svg/warning_radio.svg@#{$rd-form-invalid-color}');
}
&[data-valid='1']{
color: $form-valid-color;
}
}
}