[webpack.ue.view] fixed update
This commit is contained in:
parent
fa9964cd78
commit
fc26d4a7ef
|
@ -398,12 +398,12 @@ gstore.add('ie_handler', function(ue_i){
|
|||
|
||||
/* (5.7) Création de la requête */
|
||||
var rq = {};
|
||||
( label != ue.label ) && ( rq.label = label );
|
||||
// ( code != ue.code ) && ( rq.code = code );
|
||||
( vco != ue.volumeCours ) && ( rq.volumeCours = parseInt(vco) );
|
||||
( vtd != ue.volumeTD ) && ( rq.volumeTD = parseInt(vtd) );
|
||||
( vtp != ue.volumeTP ) && ( rq.volumeTP = parseInt(vtp) );
|
||||
( form != ue.defaultFormation ) && ( rq.defaultFormation = parseInt(form) );
|
||||
( label != ue.label ) && ( rq.label = label );
|
||||
// ( code != ue.code ) && ( rq.code = code );
|
||||
( vco != ue.volumeCours ) && ( rq.volumeCours = parseInt(vco) );
|
||||
( vtd != ue.volumeTD ) && ( rq.volumeTD = parseInt(vtd) );
|
||||
( vtp != ue.volumeTP ) && ( rq.volumeTP = parseInt(vtp) );
|
||||
( form != ue.idForm ) && ( rq.defaultFormation = parseInt(form) );
|
||||
|
||||
(new Promise( (resolve, reject) => {
|
||||
|
||||
|
@ -423,6 +423,7 @@ gstore.add('ie_handler', function(ue_i){
|
|||
api.call(`PUT ue/${ue.code}`, rq, function(rs){
|
||||
|
||||
/* (5.8.1.1) Abort on error */
|
||||
console.log(rq, rs.error != 0, rs.updated != true);
|
||||
if( rs.error != 0 || rs.updated != true )
|
||||
return reject(rs.error);
|
||||
|
||||
|
@ -438,7 +439,7 @@ gstore.add('ie_handler', function(ue_i){
|
|||
|
||||
/* (5.9.1) update VueJS element */
|
||||
gstore.get.ues[ue_i].label = label;
|
||||
gstore.get.ues[ue_i].code = code;
|
||||
// gstore.get.ues[ue_i].code = code;
|
||||
gstore.get.ues[ue_i].idForm = parseInt(form);
|
||||
gstore.get.ues[ue_i].volumeCours = parseInt(vco);
|
||||
gstore.get.ues[ue_i].volumeTD = parseInt(vtd);
|
||||
|
@ -448,10 +449,16 @@ gstore.add('ie_handler', function(ue_i){
|
|||
var fi = gstore.get.formations.map( (data, i) => { return ( data.idForm && data.idForm == form ) ? i : ''; }).join('');
|
||||
|
||||
/* (5.9.3) Exit if not found */
|
||||
if( isNaN(fi) ) return gstore.add('edit_i', -1);
|
||||
if( isNaN(fi) )
|
||||
return gstore.add('edit_i', -1);
|
||||
|
||||
/* (5.9.4) If found -> set formation label */
|
||||
gstore.get.ues[ue_i].labelForm = gstore.get.formations[fi].labelForm;
|
||||
/* (5.9.4) If not found -> set default text */
|
||||
if( !gstore.get.formations.hasOwnProperty(fi) )
|
||||
gstore.get.ues[ue_i].labelForm = '';
|
||||
|
||||
/* (5.9.5) If found -> set formation label */
|
||||
else
|
||||
gstore.get.ues[ue_i].labelForm = gstore.get.formations[fi].labelForm;
|
||||
|
||||
/* (5.9.5) Remove edit mode */
|
||||
gstore.add('edit_i', -1);
|
||||
|
|
Loading…
Reference in New Issue