Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1567 Rev 1577
Line 64... Line 64...
64
	var urlAnnuaire = SERVICE_ANNUAIRE_ID_URL + courriel;
64
	var urlAnnuaire = SERVICE_ANNUAIRE_ID_URL + courriel;
65
	$.ajax({
65
	$.ajax({
66
		url: urlAnnuaire,
66
		url: urlAnnuaire,
67
		type: 'GET',
67
		type: 'GET',
68
		success: function(data, textStatus, jqXHR) {
68
		success: function(data, textStatus, jqXHR) {
69
			console.log('SUCCESS:'+textStatus);
-
 
70
			if (data != undefined && data[courriel] != undefined) {
69
			if (data != undefined && data[courriel] != undefined) {
71
				var infos = data[courriel];
70
				var infos = data[courriel];
72
				$('#id_utilisateur').val(infos.id);
71
				$('#id_utilisateur').val(infos.id);
73
				$('#prenom').val(infos.prenom);
72
				$('#prenom').val(infos.prenom);
74
				$('#nom').val(infos.nom);
73
				$('#nom').val(infos.nom);
Line 78... Line 77...
78
			} else {
77
			} else {
79
				surErreurCompletionCourriel();
78
				surErreurCompletionCourriel();
80
			}
79
			}
81
		},
80
		},
82
		error: function(jqXHR, textStatus, errorThrown) {
81
		error: function(jqXHR, textStatus, errorThrown) {
83
			console.log('ERREUR :'+textStatus);
-
 
84
			surErreurCompletionCourriel();
82
			surErreurCompletionCourriel();
85
		},
83
		},
86
		complete: function(jqXHR, textStatus) {
84
		complete: function(jqXHR, textStatus) {
87
			console.log('COMPLETE :'+textStatus);
-
 
88
			$('#zone-prenom-nom').removeClass('hidden');
85
			$('#zone-prenom-nom').removeClass('hidden');
89
			$('#zone-courriel-confirmation').removeClass('hidden');
86
			$('#zone-courriel-confirmation').removeClass('hidden');
90
		}
87
		}
91
	});
88
	});
92
}
89
}
Line 125... Line 122...
125
 
122
 
126
//+----------------------------------------------------------------------------------------------------------+
123
//+----------------------------------------------------------------------------------------------------------+
Line 127... Line 124...
127
// GOOGLE MAP
124
// GOOGLE MAP
-
 
125
 
-
 
126
var map,
-
 
127
	geocoder,	
128
 
128
	markerDeb,
129
var map,
129
	latLngDeb,
130
	marker,
130
	markerFin,
-
 
131
	latLngFin,
Line 131... Line 132...
131
	latLng,
132
	ligneRue,
132
	geocoder;
133
	premierDeplacement = true;
-
 
134
 
Line 133... Line 135...
133
 
135
$(document).ready(function() {
134
$(document).ready(function() {
136
	initialiserGoogleMap();
135
	initialiserGoogleMap();
137
	afficherEtapeGeolocalisation(1);
136
	
138
	
Line 170... Line 172...
170
		},
172
		},
171
		// Cette partie est executee a la selection d'une adresse
173
		// Cette partie est executee a la selection d'une adresse
172
		select: function(event, ui) {
174
		select: function(event, ui) {
173
			var latLng = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
175
			var latLng = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
174
			deplacerMarker(latLng);
176
			deplacerMarker(latLng);
-
 
177
			map.setZoom(16);
175
		}
178
		}
176
	});
179
	});
Line 177... Line 180...
177
	
180
	
Line 178... Line 181...
178
	$('#geolocaliser').on('click', geolocaliser);
181
	$('#geolocaliser').on('click', geolocaliser);
Line 179... Line 182...
179
	
182
	
180
	//google.maps.event.addListener(marker, 'dragend', surDeplacementMarker);
183
	google.maps.event.addListener(markerDeb, 'dragend', surDeplacementMarkerDeb);
Line 181... Line 184...
181
	
184
	
182
	//google.maps.event.addListener(map, 'click', surClickDansCarte);
-
 
183
});
185
	google.maps.event.addListener(map, 'click', surClickDansCarte);
184
 
-
 
185
function initialiserGoogleMap(){
186
});
186
	// Carte
187
 
187
	var latLng = new google.maps.LatLng(46.30871, 2.54395),// Centre de la France
188
function initialiserGoogleMap(){
188
		zoomDefaut = 5;
189
	latLngDeb = new google.maps.LatLng(46.30871, 2.54395);// Centre de la France
189
		options = {
190
	var options = {
190
			zoom: zoomDefaut,
191
			zoom: 5,
191
			center: latLng,
192
			center: latLngDeb,
192
			mapTypeId: google.maps.MapTypeId.HYBRID,
193
			mapTypeId: google.maps.MapTypeId.HYBRID,
Line 215... Line 216...
215
	map.mapTypes.set('OSM', osmMapType);
216
	map.mapTypes.set('OSM', osmMapType);
Line 216... Line 217...
216
	
217
	
217
	// Création du Geocoder
218
	// Création du Geocoder
Line 218... Line 219...
218
	geocoder = new google.maps.Geocoder();
219
	geocoder = new google.maps.Geocoder();
219
	
220
	
220
	// Marqueur google draggable
221
	// Marqueur de début de Rue
221
	marker = new google.maps.Marker({
222
	markerDeb = new google.maps.Marker({
222
		map: map,
223
		map: map,
223
		draggable: true,
224
		draggable: true,
224
		title: 'Ma station',
225
		title: 'Début de la portion de rue étudiée',
225
		icon: GOOGLE_MAP_MARQUEUR_URL,
226
		icon: GOOGLE_MAP_MARQUEUR_DEBUT_URL,
226
		position: latLng
-
 
227
	});
227
		position: latLngDeb
Line 228... Line 228...
228
	
228
	});
229
	initialiserMarker(latLng);
-
 
230
	
229
	initialiserMarkerDeb(latLngDeb);
231
	// Tentative de geocalisation
-
 
232
	
-
 
233
	if (navigator.geolocation) {
-
 
234
		navigator.geolocation.getCurrentPosition(function(position) {
-
 
235
			var latitude = position.coords.latitude,
-
 
236
				longitude = position.coords.longitude;
-
 
237
			latLng = new google.maps.LatLng(latitude, longitude);
-
 
238
			
-
 
239
			deplacerMarker(latLng);
230
	
Line 240... Line 231...
240
		});
231
	// Tentative de geocalisation
-
 
232
	tenterGeolocalisation();
241
	}
233
}
-
 
234
 
-
 
235
function afficherErreurGoogleMap(status) {
-
 
236
	if (DEBUG) {
242
}
237
		$('#dialogue-google-map .contenu').empty().append(
243
 
238
			'<pre class="msg-erreur">'+
244
function surDeplacementMarker() {
-
 
245
	trouverCommune(marker.getPosition());
-
 
246
	mettreAJourMarkerPosition(marker.getPosition());
-
 
247
}
239
			"Le service de Géocodage de Google Map a échoué à cause de l'erreur : "+status+
Line 248... Line 240...
248
 
240
			'</pre>');
249
function surClickDansCarte(event) {
241
		afficherPanneau('#dialogue-google-map');
250
	deplacerMarker(event.latLng);
242
	}
251
}
243
}
252
 
244
 
-
 
245
function geolocaliser(event) {
-
 
246
	var latitude = $('#latitude').val(),
253
function geolocaliser(event) {
247
		longitude = $('#longitude').val();
254
	var latitude = $('#latitude').val(),
248
	latLng = new google.maps.LatLng(latitude, longitude);
Line -... Line 249...
-
 
249
	deplacerMarker(latLng);
-
 
250
	afficherEtapeGeolocalisation(2);
-
 
251
	map.setZoom(16);
-
 
252
	arreter(event);
-
 
253
}
-
 
254
 
-
 
255
function surDeplacementMarkerDeb() {
-
 
256
	trouverCommune(markerDeb.getPosition());
-
 
257
	mettreAJourMarkerPosition(markerDeb.getPosition());
-
 
258
	deplacerMarker(markerDeb.getPosition());
255
		longitude = $('#longitude').val();
259
}
256
	latLng = new google.maps.LatLng(latitude, longitude);
260
 
257
	deplacerMarker(latLng);
261
function surClickDansCarte(event) {
258
	arreter(event);
262
	deplacerMarker(event.latLng);
259
}
263
}
260
 
264
 
261
function initialiserMarker(latLng) {
265
function initialiserMarkerDeb(latLng) {
262
	if (marker != undefined) {
266
	if (markerDeb != undefined) {
Line -... Line 267...
-
 
267
		markerDeb.setPosition(latLng);
-
 
268
		map.setCenter(latLng);
-
 
269
		mettreAJourMarkerPosition(latLng);
-
 
270
		trouverCommune(latLng);
-
 
271
	}
-
 
272
}
-
 
273
 
-
 
274
function tenterGeolocalisation() {
-
 
275
	if (navigator.geolocation) {
-
 
276
		navigator.geolocation.getCurrentPosition(function(position) {
-
 
277
			var latitude = position.coords.latitude,
-
 
278
				longitude = position.coords.longitude;
-
 
279
			latLngDeb = new google.maps.LatLng(latitude, longitude);
-
 
280
			latLngFin = latLngDeb;
-
 
281
			// si l'utilisateur géolocalise sa ville alors le premier déplacement doit être réinitialisé
263
		marker.setPosition(latLng);
282
			premierDeplacement = true;
264
		map.setCenter(latLng);
283
			deplacerMarker(latLngDeb);
-
 
284
			map.setZoom(16);
265
		mettreAJourMarkerPosition(latLng);
285
		});
266
		trouverCommune(latLng);
286
	}
-
 
287
}
-
 
288
 
-
 
289
function deplacerMarker(latLng) {
-
 
290
	if (markerDeb != undefined) {
-
 
291
		latLngDeb = latLng;
-
 
292
		markerDeb.setPosition(latLngDeb);
-
 
293
		map.setCenter(latLngDeb);
-
 
294
		trouverCommune(latLngDeb);
-
 
295
		
-
 
296
		if (!premierDeplacement) {
-
 
297
			if (markerFin != undefined) {
-
 
298
				markerFin.setMap(null);
-
 
299
			}
-
 
300
			
-
 
301
			latLngFin = new google.maps.LatLng(latLngDeb.lat(), latLngDeb.lng() + 0.0010);
-
 
302
			markerFin = new google.maps.Marker({
-
 
303
				map: map,
-
 
304
				draggable: true,
-
 
305
				title: 'Fin de la portion de rue étudiée',
-
 
306
				icon: GOOGLE_MAP_MARQUEUR_FIN_URL,
-
 
307
				position: latLngFin
-
 
308
			});
-
 
309
			google.maps.event.addListener(markerFin, 'dragend', function() {
-
 
310
				dessinerLigneRue(markerDeb.getPosition(), markerFin.getPosition());
-
 
311
				latLngDeb = markerDeb.getPosition();
-
 
312
				latLngFin = markerFin.getPosition();
-
 
313
				latLngCentre = new google.maps.LatLng((latLngFin.lat() + latLngDeb.lat())/2, (latLngFin.lng() + latLngDeb.lng())/2); 
267
	}
314
				mettreAJourMarkerPosition(latLngCentre);
-
 
315
				afficherEtapeGeolocalisation(4);
-
 
316
			});
268
}
317
			
-
 
318
			dessinerLigneRue(latLngDeb, latLngFin);
-
 
319
			
-
 
320
			latLngCentre = new google.maps.LatLng((latLngFin.lat() + latLngDeb.lat())/2, (latLngFin.lng() + latLngDeb.lng())/2); 
-
 
321
			mettreAJourMarkerPosition(latLngCentre);
-
 
322
			afficherEtapeGeolocalisation(3);
-
 
323
		} else {
-
 
324
			mettreAJourMarkerPosition(latLngDeb);
-
 
325
		}
269
 
326
		premierDeplacement = false;
-
 
327
	}
-
 
328
}
-
 
329
 
-
 
330
function dessinerLigneRue(pointDebut, pointFin) {
-
 
331
	if (ligneRue != undefined) {
-
 
332
		ligneRue.setMap(null);
-
 
333
	}
-
 
334
	
-
 
335
	ligneRue = new google.maps.Polyline({
-
 
336
		path: [pointDebut, pointFin],
-
 
337
		strokeColor: "#FF0000",
-
 
338
		strokeOpacity: 1.0,
-
 
339
		strokeWeight: 2
-
 
340
	});
270
function deplacerMarker(latLng) {
341
 
Line 271... Line 342...
271
	if (marker != undefined) {
342
	ligneRue.setMap(map);
272
		marker.setPosition(latLng);
343
}
273
		map.setCenter(latLng);
344
 
Line 368... Line 439...
368
		source: function(requete, add){  
439
		source: function(requete, add){  
369
			// la variable de requête doit être vidée car sinon le parametre "term" est ajouté
440
			// la variable de requête doit être vidée car sinon le parametre "term" est ajouté
Line 370... Line 441...
370
			
441
			
371
			var url = getUrlAutocompletionNomsSci();
442
			var url = getUrlAutocompletionNomsSci();
372
			$.getJSON(url, function(data) {
-
 
373
				console.log(data);
443
			$.getJSON(url, function(data) {
374
				var suggestions = traiterRetourNomsSci(data);
444
				var suggestions = traiterRetourNomsSci(data);
375
				add(suggestions);  
445
				add(suggestions);  
376
			});
446
			});
377
		},
447
		},
Line 472... Line 542...
472
})(jQuery);
542
})(jQuery);
Line 473... Line 543...
473
 
543
 
474
//+----------------------------------------------------------------------------------------------------------+
544
//+----------------------------------------------------------------------------------------------------------+
475
//UPLOAD PHOTO : Traitement de l'image 
545
//UPLOAD PHOTO : Traitement de l'image 
476
$(document).ready(function() {
546
$(document).ready(function() {
-
 
547
	$('#fichier').on('click change', function(event) {
-
 
548
		if ($(this).val().length > 0) {
-
 
549
			arreter(event);
-
 
550
			var options = { 
-
 
551
				success: afficherMiniature, // post-submit callback 
-
 
552
				dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type) 
-
 
553
				resetForm: true // reset the form after successful submit 
477
	$('body').on('click', '.effacer-miniature', function(event) {
554
			};
-
 
555
			$('#miniature').append(
-
 
556
				'<img id="miniature-chargement" class="miniature" alt="chargement" src="'+CHARGEMENT_IMAGE_URL+'"/>');
-
 
557
			$('#ajouter-obs').attr('disabled', 'disabled');
-
 
558
			if (verifierFormat($(this).val())) {
-
 
559
				$('#form-upload').ajaxSubmit(options);
-
 
560
			} else {
-
 
561
				window.alert("Le format de fichier n'est pas supporté, les formats acceptés sont "+	$('#fichier').attr('accept'));
-
 
562
			}
-
 
563
			return false;
478
		supprimerMiniature($(this));
564
		}
Line 479... Line 565...
479
	});
565
	});
480
	
566
	
481
	$('#photo-placeholder').click(function(event) {
567
	$('#photo-placeholder').click(function(event) {
Line 482... Line 568...
482
		$('#fichier').click();
568
		$('#fichier').click();
483
	});
-
 
484
	
-
 
485
	$('#fichier').bind('change', function (e) {
-
 
486
		arreter(e);
-
 
487
		var options = { 
-
 
488
			success: afficherMiniature, // post-submit callback 
-
 
489
			dataType: 'xml', // 'xml', 'script', or 'json' (expected server response type) 
569
	});
490
			resetForm: true // reset the form after successful submit 
-
 
491
		};
-
 
492
		$('#miniature').append(
-
 
493
			'<img id="miniature-chargement" class="miniature" alt="chargement" src="'+CHARGEMENT_IMAGE_URL+'"/>');
-
 
494
		$('#ajouter-obs').attr('disabled', 'disabled');
-
 
495
		if (verifierFormat($('#fichier').val())) {
-
 
496
			$('#form-upload').ajaxSubmit(options);
-
 
497
		} else {
-
 
498
			window.alert("Le format de fichier n'est pas supporté, les formats acceptés sont "+	$('#fichier').attr('accept'));
-
 
499
		}
-
 
500
		return false;
-
 
501
	});
-
 
502
	
570
	
503
	$('.effacer-miniature').on('click', function() {
571
	$('body').on('click', '.effacer-miniature', function(event) {
Line -... Line 572...
-
 
572
		supprimerMiniature($(this));
-
 
573
	});
504
		$(this).parent().remove();
574
});
505
	});
575
 
506
});
576
 
507
 
577
 
508
function verifierFormat(nom) {
578
function verifierFormat(nom) {
Line 509... Line 579...
509
	var parts = nom.split('.');
579
	var parts = nom.split('.');
510
	extension = parts[parts.length - 1];
580
	extension = parts[parts.length - 1];
511
	return (extension.toLowerCase() == 'jpeg' || extension.toLowerCase() == 'jpg');
581
	return (extension.toLowerCase() == 'jpeg' || extension.toLowerCase() == 'jpg');
512
}
582
}
513
 
583
 
514
function afficherMiniature(reponse) { 
584
function afficherMiniature(reponse) { 
515
	if (DEBUG) {
585
	if (DEBUG) {
516
		var debogage = $('debogage', reponse).text();
586
		var debogage = $('debogage', reponse).text();
517
		console.log('Débogage upload : ' + debogage);
587
		//console.log('Débogage upload : ' + debogage);
518
	}
588
	}
519
	var message = $('message', reponse).text();
589
	var message = $('message', reponse).text();
520
	if (message != '') {
590
	if (message != '') {
521
		$('#miniature-msg').append(message);
591
		$('#miniature-msg').append(message);
Line 522... Line 592...
522
	} else {
592
	} else {
523
		$('#miniatures').append(creerWidgetMiniature(reponse));
593
		$('#miniatures').append(creerWidgetMiniature(reponse));
524
	}
594
	}
Line 598... Line 668...
598
	});
668
	});
Line 599... Line 669...
599
	
669
	
600
	$('input#hauteur-plante').on('blur', function() {
670
	$('input#hauteur-plante').on('blur', function() {
601
		// if there's a bad value
671
		// if there's a bad value
602
		var valeur = $(this).val();
-
 
603
		console.log(valeur);
672
		var valeur = $(this).val();
604
		if (! valeur.match(/^[0-9]+$/)) {
673
		if (! valeur.match(/^[0-9]+$/)) {
605
			// replace it with nothing
674
			// replace it with nothing
606
			var nouvelleValeur = valeur.replace(/[^0-9]/g, '');
675
			var nouvelleValeur = valeur.replace(/[^0-9]/g, '');
607
			$(this).val(nouvelleValeur);
676
			$(this).val(nouvelleValeur);
Line 692... Line 761...
692
		buttonImage: CALENDRIER_ICONE_URL,
761
		buttonImage: CALENDRIER_ICONE_URL,
693
		buttonText: 'Afficher le calendrier pour saisir la date.',
762
		buttonText: 'Afficher le calendrier pour saisir la date.',
694
		showButtonPanel: true,
763
		showButtonPanel: true,
695
		onSelect: function(date) {
764
		onSelect: function(date) {
696
			$(this).valid();
765
			$(this).valid();
697
        }
766
		}
698
	});
767
	});
699
	$(selector + ' + img.ui-datepicker-trigger').appendTo(selector + '-icone.add-on');
768
	$(selector + ' + img.ui-datepicker-trigger').appendTo(selector + '-icone.add-on');
700
}
769
}
Line 701... Line 770...
701
 
770
 
Line 778... Line 847...
778
				'dateCel' : true},
847
				'dateCel' : true},
779
			dateDerniereIntervention: {
848
			dateDerniereIntervention: {
780
				required: true}
849
				required: true}
781
		},
850
		},
782
		errorPlacement: function(error, element) {
851
		errorPlacement: function(error, element) {
783
	        if (element.attr('name') == 'date') {
852
			if (element.attr('name') == 'date') {
784
		        element.parent('.input-prepend').after(error);
853
				element.parent('.input-prepend').after(error);
785
	        } else {
854
			} else {
786
	        	error.insertAfter(element);
855
				error.insertAfter(element);
787
	        }
856
			}
788
	    }
857
		}
789
	});
858
	});
790
	$('#form-obs').validate({
859
	$('#form-obs').validate({
791
		rules: {
860
		rules: {
792
			'taxon-liste': {
861
			'taxon-liste': {
793
				required: true},
862
				required: true},
Line 799... Line 868...
799
				digits: true},
868
				digits: true},
800
			resistanceTraitementPhyto: {
869
			resistanceTraitementPhyto: {
801
				required: true}
870
				required: true}
802
		},
871
		},
803
		errorPlacement: function(error, element) {
872
		errorPlacement: function(error, element) {
804
	        if (element.attr('name') == 'milieux[]') {
873
			if (element.attr('name') == 'milieux[]') {
805
		        error.insertAfter('#milieux-controls');
874
				error.insertAfter('#milieux-controls');
806
	        } else {
875
			} else {
807
	        	error.insertAfter(element);
876
				error.insertAfter(element);
808
	        }
877
			}
809
	    }
878
		}
810
	});
879
	});
811
}
880
}
Line 812... Line 881...
812
 
881
 
813
function validerFormulaire() {
882
function validerFormulaire() {
814
	var observateur = $('#form-observateur').valid(),
883
	var observateur = $('#form-observateur').valid(),
815
		station = $('#form-site').valid(),
884
		station = $('#form-site').valid(),
816
		date = $('#form-date').valid(),
885
		date = $('#form-date').valid(),
-
 
886
		obs = $('#form-obs').valid(),
-
 
887
		debRue = (latLngDeb == undefined) ? false : true,
817
		obs = $('#form-obs').valid();
888
		finRue = (latLngFin == undefined) ? false : true;
-
 
889
	var ok = (observateur && station && obs && date && debRue && finRue) ? true : false;
-
 
890
	//console.log(observateur+'-'+station+'-'+obs+'-'+date+'-'+debRue+'-'+finRue);
818
	return (observateur == true && station == true && obs == true && date == true) ? true : false;
891
	return ok;
Line 819... Line 892...
819
}
892
}
820
 
893
 
Line 859... Line 932...
859
		$('.obs-nbre').text(obsNbre);
932
		$('.obs-nbre').text(obsNbre);
860
		$('.obs-nbre').triggerHandler('changement');
933
		$('.obs-nbre').triggerHandler('changement');
861
		afficherObs();
934
		afficherObs();
862
		stockerObsData();
935
		stockerObsData();
863
		supprimerMiniatures();
936
		supprimerMiniatures();
864
		$('#taxon').val('').data('numNomSel', undefined).removeClass('ns-retenu');
-
 
865
	} else {
937
	} else {
-
 
938
		var debRue = (latLngDeb == undefined) ? false : true,
-
 
939
			finRue = (latLngFin == undefined) ? false : true;
-
 
940
		if (debRue == false || finRue == false) {
-
 
941
			afficherPanneau('#dialogue-form-invalide-rue');
-
 
942
		} else {
866
		afficherPanneau('#dialogue-form-invalide');
943
			afficherPanneau('#dialogue-form-invalide');			
-
 
944
		}
867
	}
945
	}
868
}
946
}
Line 869... Line 947...
869
 
947
 
870
function afficherObs() {
948
function afficherObs() {
Line 980... Line 1058...
980
	var miniatureSelectionne = element.siblings('img.miniature-selectionnee');
1058
	var miniatureSelectionne = element.siblings('img.miniature-selectionnee');
981
	miniatureSelectionne.removeClass('miniature-selectionnee').addClass('miniature-cachee');
1059
	miniatureSelectionne.removeClass('miniature-selectionnee').addClass('miniature-cachee');
982
	var miniatureAffichee = miniatureSelectionne;
1060
	var miniatureAffichee = miniatureSelectionne;
Line 983... Line 1061...
983
	
1061
	
984
	var indicateurActif = element.parent().find('.defilement-indicateurs .active');
-
 
985
	console.log(indicateurActif)
1062
	var indicateurActif = element.parent().find('.defilement-indicateurs .active');
Line 986... Line 1063...
986
	indicateurActif.removeClass('active');
1063
	indicateurActif.removeClass('active');
987
	
1064
	
988
	if (element.hasClass('defilement-control-zone') && element.hasClass('gauche')) {
1065
	if (element.hasClass('defilement-control-zone') && element.hasClass('gauche')) {
Line 1104... Line 1181...
1104
		'image_nom': getNomsImgsOriginales(),
1181
		'image_nom': getNomsImgsOriginales(),
Line 1105... Line 1182...
1105
		
1182
		
1106
		// Ajout des champs étendus de l'obs
1183
		// Ajout des champs étendus de l'obs
1107
		'obs_etendue': getObsChpEtendus()
1184
		'obs_etendue': getObsChpEtendus()
1108
	});
1185
	});
1109
	console.log($('#liste-obs').data('obsId'+obsNbre));
1186
	//console.log($('#liste-obs').data('obsId'+obsNbre));
Line 1110... Line 1187...
1110
}
1187
}
1111
 
1188
 
1112
function getObsChpEtendus() {
1189
function getObsChpEtendus() {
1113
	var champs = [],
1190
	var champs = [],
1114
		perceptionTechnicien = getPerceptionTechnicien();
1191
		perceptionTechnicien = getPerceptionTechnicien();
1115
	if (perceptionTechnicien != undefined) {
1192
	if (perceptionTechnicien != undefined) {
-
 
1193
		champs.push(perceptionTechnicien);
-
 
1194
	}
-
 
1195
	if (latLngDeb != undefined) {
-
 
1196
		var latitudeDebutRue = {cle: 'latitudeDebutRue', label: 'Latitude du début de la rue', valeur: latLngDeb.lat().toFixed(5)};
-
 
1197
		champs.push(latitudeDebutRue);
-
 
1198
		var longitudeDebutRue = {cle: 'longitudeDebutRue', label: 'Longitude du début de la rue', valeur: latLngDeb.lng().toFixed(5)};
-
 
1199
		champs.push(longitudeDebutRue);
-
 
1200
	}
-
 
1201
	if (latLngFin != undefined) {
-
 
1202
		var latitudeFinRue = {cle: 'latitudeFinRue', label: 'Latitude de fin de la rue', valeur: latLngFin.lat().toFixed(5)};
-
 
1203
		champs.push(latitudeFinRue);
-
 
1204
		var longitudeFinRue = {cle: 'longitudeFinRue', label: 'Longitude de fin de la rue', valeur: latLngFin.lng().toFixed(5)};
-
 
1205
		champs.push(longitudeFinRue);
1116
		champs.push(perceptionTechnicien);
1206
	}
1117
	}
1207
	
1118
	$('.obs-chp-etendu').each(function() {
1208
	$('.obs-chp-etendu').each(function() {
1119
		var valeur = $(this).val(),
1209
		var valeur = $(this).val(),
1120
			cle = $(this).attr('name'),
1210
			cle = $(this).attr('name'),
Line 1143... Line 1233...
1143
//+----------------------------------------------------------------------------------------------------------+
1233
//+----------------------------------------------------------------------------------------------------------+
1144
// TRANSFERER OBS : envoie des obs au CEL
1234
// TRANSFERER OBS : envoie des obs au CEL
Line 1145... Line 1235...
1145
 
1235
 
1146
function transmettreObs() {
1236
function transmettreObs() {
1147
	var observations = $('#liste-obs').data();
-
 
Line 1148... Line 1237...
1148
	console.log(observations);
1237
	var observations = $('#liste-obs').data();
1149
	
1238
	
1150
	if (observations == undefined || jQuery.isEmptyObject(observations)) {
1239
	if (observations == undefined || jQuery.isEmptyObject(observations)) {
1151
		afficherPanneau('#dialogue-zero-obs');
1240
		afficherPanneau('#dialogue-zero-obs');