Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3329 → Rev 3333

/trunk/widget/modules/apa/squelettes/js/ReleveApa.js
680,6 → 680,7
* Fonction handler de l'évenement location du module tb-geoloc
*/
ReleveApa.prototype.locationHandler = function( location ) {
const lthis = this;
var locDatas = location.originalEvent.detail;
 
if ( this.utils.valOk( locDatas ) ) {
715,7 → 716,7
communeInsee = ( this.utils.valOk( locDatas.inseeData.code ) ) ? locDatas.inseeData.code : '';
} else if ( this.utils.valOk( locDatas.locality ) ) {
nomCommune = locDatas.locality;
} else if ( this.utils.valOk( locDatas.locality ) ) {
} else if ( this.utils.valOk( locDatas.osmCounty ) ) {
nomCommune = locDatas.osmCounty;
}
$( '#rue' ).val( rue );
726,16 → 727,22
$( '#altitude' ).val( altitude );
$( '#pays' ).val( pays );
if ( this.utils.valOk( $( '#rue' ).val() ) && this.utils.valOk( $( '#commune-nom' ).val() ) ) {
if( !this.utils.valOk( $( '#geoloc #error-drc' ) ) ) {
$( '#geoloc' ).closest( '.control-group' ).removeClass( 'error' );
}
$( '#geoloc-error' ).addClass( 'hidden' );
} else {
$( '#geoloc' ).closest( '.control-group' ).addClass( 'error' );
$( '#geoloc' ).addClass( 'hidden' );
$( '#rue,#commune-nom' ).prop( 'disabled', false );
$( '#geoloc-datas' ).removeClass( 'hidden' );
$( '#geoloc-datas' ).closest( '.control-group' ).addClass( 'error' );
$( '#geoloc-error' ).removeClass( 'hidden' );
$( '#releve-date' ).removeClass( 'erreur' ).closest( '.control-group' ).removeClass( 'error' ).find( '#error-drc' ).remove();
$( '#geoloc #error-drc' ).remove();
}
$( '#rue,#commune-nom' ).change( function() {
if ( lthis.utils.valOk( $( '#rue' ).val() ) && lthis.utils.valOk( $( '#commune-nom' ).val() ) ) {
$( '#geoloc-error' ).addClass( 'hidden' );
} else {
$( '#geoloc-error' ).removeClass( 'hidden' );
}
});
} else {
console.log( 'Error location' );
}
821,25 → 828,7
this.releveDatas = $.parseJSON( $( '#releve-data' ).val() );
this.releveDatas[this.obsNbre] = arbreData;
$( '#releve-data' ).val( JSON.stringify( this.releveDatas ) );
 
this.supprimerMiniatures();
$( '#taxon' ).val( '' );
$( '#taxon' ).data( 'numNomSel', '' )
.data( 'nomRet','' )
.data( 'numNomRet', '' )
.data( 'nt', '' )
.data( 'famille', '' );
if( this.isTaxonListe ) {
$( '#taxon-liste' ).find( 'option' ).each( function() {
if ( $( this ).hasClass( 'choisir' ) ) {
$( this ).attr( 'selected', true );
} else {
$( this ).attr( 'selected', false );
}
});
$( '#taxon-input-groupe' ).addClass( 'hidden' );
$('#taxon-autre').val('');
}
this.modeArbresBasculerActivation( false );
$( '#barre-progression-upload' ).attr( 'aria-valuemax', this.obsNbre );
$( '#barre-progression-upload .sr-only' ).text( '0/' + this.obsNbre + ' ' + this.utils.msgTraduction( 'observations-transmises' ) );
} else {
1310,7 → 1299,6
}
});
}
 
this.modeArbresBasculerActivation( desactiverForm, numArbre );
};
 
1340,7 → 1328,6
$( '#geoloc-datas-arbres,#retour' ).addClass( 'hidden' );
// retour aux valeurs par defaut
$( '#equipement-pied-arbre .other' ).text( 'Autre' ).val( 'other' );
// $( '#equipement-pied-arbre .other' ).val( 'other' );
$(
'#certitude option,'+
'#equipement-pied-arbre option,'+
1352,15 → 1339,9
$( this ).prop( 'selected', false );
}
});
$( '#taxon' ).data( 'numNomSel', '' )
.data( 'nomRet','' )
.data( 'numNomRet', '' )
.data( 'nt', '' )
.data( 'famille', '' );
this.supprimerMiniatures();
$( '#dejections,#face-ombre' ).find( 'input' ).prop( 'checked', false );
$(
'#taxon,'+
'#circonference,'+
'#surface-pied,'+
'#com-arbres,'+
1371,9 → 1352,11
'#equipement-pied-arbre,'+
'#tassement'
).val( '' );
$( '#arbre-nb' ).text( numArbre );
$( '#arbre-info-lien-' + numArbre ).addClass( 'disabled' );
$( '.arbre-info' ).not( '#arbre-info-lien-' + numArbre ).removeClass( 'disabled' );
if( 0 < numArbre ) {
$( '#arbre-nb' ).text( numArbre );
$( '#arbre-info-lien-' + numArbre ).addClass( 'disabled' );
$( '.arbre-info' ).not( '#arbre-info-lien-' + numArbre ).removeClass( 'disabled' );
}
}
};
 
1436,7 → 1419,8
exId = 0,
indexObs = '',
exIndexObs = '',
arbreExId = 0;
arbreExId = 0,
arbreId = 0;
 
for ( var id = obsId; id <= ( this.obsNbre + 1 ); id++ ) {
exId = parseInt(id) + 1;
1779,7 → 1763,6
.closest( '.control-group' )
.removeClass( 'error' );
}
$( '#geoloc #error-drc' ).remove();
} else {
$( '#releve-date' )
.addClass( 'erreur' )
1789,9 → 1772,6
$( '#releve-date' ).after( errorDateRue );
}
$( '#geoloc' ).closest( '.control-group' ).addClass( 'error' );
if ( !this.utils.valOk( $( '#geoloc' ).find( '#error-drc' ) ) ) {
$( '#geoloc' ).prepend( errorDateRue );
}
}
if ( dateValid ) {
$( '#releve-date' ).closest( '.control-group span.error' ).not( '#error-drc' ).remove();