Subversion Repositories eFlore/Applications.cel

Rev

Rev 3211 | Rev 3230 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3211 Rev 3217
Line 39... Line 39...
39
 * Initialisation du widget
39
 * Initialisation du widget
40
 */
40
 */
41
WidgetSaisie.prototype.init = function() {
41
WidgetSaisie.prototype.init = function() {
42
  this.initForm();
42
  this.initForm();
43
  this.initEvts();
43
  this.initEvts();
-
 
44
  // Auth.js s'en occuppe
44
  if ( '' === $( '#nom-complet').val() && '' !== $( '#courriel' ).val() ) {
45
  if ( '' === $( '#nom-complet').text() && '' !== $( '#courriel' ).val() ) {
45
    this.requeterIdentite();
46
    this.requeterIdentite();
46
  }
47
  }
47
};
48
};
Line 48... Line 49...
48
 
49
 
Line 123... Line 124...
123
    }
124
    }
124
    return false;
125
    return false;
125
  });
126
  });
Line 126... Line 127...
126
 
127
 
127
  // identité
128
  // identité
128
  if ( '' === $( '#nom-complet').val() ) {
129
  if ( '' === $( '#nom-complet').text() ) {
129
    $( '#courriel' ).on( 'blur', this.requeterIdentite.bind( this ) );
130
    $( '#courriel' ).on( 'blur', this.requeterIdentite.bind( this ) );
130
    $( '#courriel' ).on( 'keypress', this.testerLancementRequeteIdentite.bind( this ) );
131
    $( '#courriel' ).on( 'keypress', this.testerLancementRequeteIdentite.bind( this ) );
131
  }
132
  }
132
  $( '.alert .close' ).on( 'click', this.fermerPanneauAlert );
133
  $( '.alert .close' ).on( 'click', this.fermerPanneauAlert );
Line 265... Line 266...
265
  }
266
  }
266
};
267
};
Line 267... Line 268...
267
 
268
 
268
WidgetSaisie.prototype.surSuccesCompletionCourriel = function( infos, courriel ) {
269
WidgetSaisie.prototype.surSuccesCompletionCourriel = function( infos, courriel ) {
269
  $( '#zone-courriel' ).before( '<p class="warning"><i class="fas fa-exclamation-triangle"></i> Un compte existe pour ce courriel, connectez-vous pour saisir votre observation</p>' );
270
  $( '#zone-courriel' ).before( '<p class="warning"><i class="fas fa-exclamation-triangle"></i> Un compte existe pour ce courriel, connectez-vous pour saisir votre observation</p>' );
-
 
271
  $( '#bouton-inscription, #zone-prenom-nom, #zone-courriel-confirmation' ).addClass( 'hidden' );
270
  $( '#creation-compte, #zone-prenom-nom, #zone-courriel-confirmation' ).addClass( 'hidden' );
272
  $( '#prenom, #nom, #courriel_confirmation' ).attr( 'disabled', 'disabled' );
271
  $( '#bouton-connexion a' ).css( 'box-shadow', '0 0 1.5px 1px red' );
273
  $( '#bouton-connexion a' ).css( 'box-shadow', '0 0 1.5px 1px red' );
272
  // // Traité par auth.js :
274
  // // Traité par auth.js :
273
  // $( '#id_utilisateur' ).val(infos.id);
275
  // $( '#id_utilisateur' ).val(infos.id);
274
  // // console.log(infos);
276
  // // console.log(infos);
275
  // $( '#prenom' ).val(infos.prenom);
277
  // $( '#prenom' ).val(infos.prenom);
276
  // $( '#nom' ).val(infos.nom);
278
  // $( '#nom' ).val(infos.nom);
277
  // $( '#courriel_confirmation' ).val(courriel);
-
 
278
  // $( '#prenom, #nom, #courriel_confirmation' ).attr( 'disabled', 'disabled' );
279
  // $( '#courriel_confirmation' ).val(courriel);
279
  // this.focusChampFormulaire();
280
  // this.focusChampFormulaire();
280
  // // todo function masquerPanneau
281
  // // todo function masquerPanneau
281
  // this.masquerPanneau( '#dialogue-courriel-introuvable' );
282
  // this.masquerPanneau( '#dialogue-courriel-introuvable' );
Line 828... Line 829...
828
  });
829
  });
Line 829... Line 830...
829
 
830
 
830
  $( '#taxon' ).bind( 'autocompleteselect', this.surAutocompletionTaxon );
831
  $( '#taxon' ).bind( 'autocompleteselect', this.surAutocompletionTaxon );
Line -... Line 832...
-
 
832
};
-
 
833
 
-
 
834
// /* auto completion nom sci */
-
 
835
// WidgetSaisie.prototype.ajouterAutocompletionNoms = function() {
-
 
836
//   var lthis = this;
-
 
837
//   $( '#taxon' ).autocomplete({
-
 
838
//     source: function( requete, add ) {
-
 
839
//       // la variable de requête doit être vidée car sinon le parametre 'term' est ajouté
-
 
840
//       requete = '';
-
 
841
//       if( 'autre' !== $( '#referentiel' ).val() ) {
-
 
842
//         var url = lthis.getUrlAutocompletionNomsSci();
-
 
843
//         // console.log( url );
-
 
844
//         $.getJSON( url, requete, function( data ) {
-
 
845
//           var suggestions = lthis.traiterRetourNomsSci( data );
-
 
846
//           add( suggestions );
-
 
847
//         });
-
 
848
//       }
-
 
849
//     },
-
 
850
//     html: true,
-
 
851
//     position : {
-
 
852
//         my : 'top',
-
 
853
//         at : 'top'
-
 
854
//     }
-
 
855
//   });
-
 
856
 
-
 
857
//   $( '#taxon' ).bind( 'autocompleteselect', this.surAutocompletionTaxon );
831
};
858
// };
832
 
859
 
833
// WidgetSaisie.prototype.focusChampFormulaire = function() {
860
// WidgetSaisie.prototype.focusChampFormulaire = function() {
Line 834... Line 861...
834
//  $( '#date_releve' ).focus();
861
//  $( '#date_releve' ).focus();
Line 996... Line 1023...
996
    }
1023
    }
997
  });
1024
  });
998
  $( selector + ' + img.ui-datepicker-trigger' ).appendTo( selector + '-icone.add-on' );
1025
  $( selector + ' + img.ui-datepicker-trigger' ).appendTo( selector + '-icone.add-on' );
999
};
1026
};
Line 1000... Line -...
1000
 
-
 
1001
/* auto completion nom sci */
-
 
1002
WidgetSaisie.prototype.ajouterAutocompletionNoms = function() {
-
 
1003
  var lthis = this;
-
 
1004
  $( '#taxon' ).autocomplete({
-
 
1005
    source: function( requete, add ) {
-
 
1006
      // la variable de requête doit être vidée car sinon le parametre 'term' est ajouté
-
 
1007
      requete = '';
-
 
1008
      if( 'autre' !== $( '#referentiel' ).val() ) {
-
 
1009
        var url = lthis.getUrlAutocompletionNomsSci();
-
 
1010
        // console.log( url );
-
 
1011
        $.getJSON( url, requete, function( data ) {
-
 
1012
          var suggestions = lthis.traiterRetourNomsSci( data );
-
 
1013
          add( suggestions );
-
 
1014
        });
-
 
1015
      }
-
 
1016
    },
-
 
1017
    html: true,
-
 
1018
    position : {
-
 
1019
        my : 'top',
-
 
1020
        at : 'top'
-
 
1021
    }
-
 
1022
  });
-
 
1023
 
-
 
1024
  $( '#taxon' ).bind( 'autocompleteselect', this.surAutocompletionTaxon );
-
 
1025
};
-
 
1026
 
1027
 
1027
WidgetSaisie.prototype.surAutocompletionTaxon = function( event, ui ) {
1028
WidgetSaisie.prototype.surAutocompletionTaxon = function( event, ui ) {
1028
  $( '#taxon' ).data( ui.item );
1029
  $( '#taxon' ).data( ui.item );
1029
  if ( ui.item.retenu ) {
1030
  if ( ui.item.retenu ) {
1030
    $( '#taxon' ).addClass( 'ns-retenu' );
1031
    $( '#taxon' ).addClass( 'ns-retenu' );