2707 |
mathias |
1 |
// Héritage
|
|
|
2 |
function WidgetSaisieFlorileges() {
|
|
|
3 |
this.latLngDebPre = {lat: null, lng: null};
|
|
|
4 |
this.latLngFinPre = {lat: null, lng: null};
|
|
|
5 |
this.okPourChargementCarte = 2;
|
|
|
6 |
this.markerDeb = null;
|
|
|
7 |
this.latLngDeb = null;
|
|
|
8 |
this.markerFin = null;
|
|
|
9 |
this.latLngFin = null;
|
|
|
10 |
this.ligneRue = null;
|
|
|
11 |
this.googleMapMarqueurDebutUrl = null;
|
|
|
12 |
this.googleMapMarqueurFinUrl = null;
|
|
|
13 |
this.premierDeplacement = true;
|
|
|
14 |
}
|
2708 |
mathias |
15 |
WidgetSaisieFlorileges.prototype = new WidgetSaisieSauvages();
|
2707 |
mathias |
16 |
|
2708 |
mathias |
17 |
|
|
|
18 |
// @TODO harmoniser avec Sauvages (rue)
|
2707 |
mathias |
19 |
WidgetSaisieFlorileges.prototype.initCarto = function() {
|
|
|
20 |
var lthis = this;
|
|
|
21 |
|
|
|
22 |
this.initialiserGoogleMap();
|
|
|
23 |
this.afficherEtapeGeolocalisation(1);
|
|
|
24 |
|
|
|
25 |
$('#carte-recherche').autocomplete({
|
|
|
26 |
//Cette partie utilise geocoder pour extraire des valeurs d'adresse
|
|
|
27 |
source: function(request, response) {
|
|
|
28 |
|
|
|
29 |
lthis.geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
|
|
|
30 |
if (status == google.maps.GeocoderStatus.OK) {
|
|
|
31 |
response($.map(results, function(item) {
|
|
|
32 |
var retour = {
|
|
|
33 |
label: item.formatted_address,
|
|
|
34 |
value: item.formatted_address,
|
|
|
35 |
latitude: item.geometry.location.lat(),
|
|
|
36 |
longitude: item.geometry.location.lng()
|
|
|
37 |
};
|
|
|
38 |
return retour;
|
|
|
39 |
}));
|
|
|
40 |
} else {
|
|
|
41 |
lthis.afficherErreurGoogleMap(status);
|
|
|
42 |
}
|
|
|
43 |
});
|
|
|
44 |
},
|
|
|
45 |
// Cette partie est executee a la selection d'une adresse
|
|
|
46 |
select: function(event, ui) {
|
|
|
47 |
var nouvellePosition = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
|
|
|
48 |
lthis.initialiserMarkerDeb();
|
|
|
49 |
lthis.deplacerMarkerDeb(nouvellePosition);
|
|
|
50 |
lthis.map.setZoom(16);
|
|
|
51 |
lthis.afficherEtapeGeolocalisation(2);
|
|
|
52 |
}
|
|
|
53 |
});
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
WidgetSaisieFlorileges.prototype.initForm = function() {
|
|
|
57 |
// super() à la main - toute autre manière de faire est über-komplex
|
|
|
58 |
WidgetSaisie.prototype.initForm.call(this);
|
|
|
59 |
|
|
|
60 |
this.configurerDatePicker('#date-arret-traitement-phyto');
|
|
|
61 |
this.surChangementTaxonListe();// Vérif lors du chargement de la page
|
|
|
62 |
$('#taxon-liste').on('change', this.surChangementTaxonListe.bind(this));
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
WidgetSaisieFlorileges.prototype.initEvts = function() {
|
|
|
66 |
var lthis = this;
|
|
|
67 |
// super() à la main - toute autre manière de faire est über-komplex
|
|
|
68 |
WidgetSaisie.prototype.initEvts.call(this);
|
|
|
69 |
|
|
|
70 |
$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) {
|
|
|
71 |
event.stopPropagation();
|
|
|
72 |
});
|
|
|
73 |
|
|
|
74 |
// Afficher/Cacher champs cachés par défaut
|
|
|
75 |
this.surChangementPeriodiciteTraitementPhyto();// Vérif lors du chargement de la page
|
|
|
76 |
$('#periodicite-traitement-phyto').on('change', this.surChangementPeriodiciteTraitementPhyto.bind(this));
|
|
|
77 |
|
|
|
78 |
// Sliders
|
|
|
79 |
this.transformerEnSlider('#presence-zone-vegetalise');
|
|
|
80 |
this.transformerEnSlider('#hauteur-batiment-avoisinant');
|
|
|
81 |
this.transformerEnSlider('#periodicite-traitement-phyto');
|
|
|
82 |
this.transformerEnSlider('#resistance-traitement-phyto');
|
|
|
83 |
this.transformerEnSlider('#vitesse-croissance');
|
|
|
84 |
|
|
|
85 |
// Gestion des obs
|
|
|
86 |
$('.cb-milieux').on('click', function(event) {
|
|
|
87 |
$(this).valid();
|
|
|
88 |
event.stopPropagation();
|
|
|
89 |
});
|
|
|
90 |
$('input#hauteur-plante').on('blur', function() {
|
|
|
91 |
// if there's a bad value
|
|
|
92 |
var valeur = $(this).val();
|
|
|
93 |
if (! valeur.match(/^[0-9]+$/)) {
|
|
|
94 |
// replace it with nothing
|
|
|
95 |
var nouvelleValeur = valeur.replace(/[^0-9]/g, '');
|
|
|
96 |
$(this).val(nouvelleValeur);
|
|
|
97 |
}
|
|
|
98 |
});
|
|
|
99 |
|
|
|
100 |
// Défilement des photos @TODO harmoniser
|
|
|
101 |
$('body').on('click', '.defilement-control-zone', function(event) {
|
|
|
102 |
lthis.defilerMiniatures($(this));
|
|
|
103 |
});
|
|
|
104 |
$('body').on('mouseover', '.defilement-control-zone', function(event) {
|
|
|
105 |
$('.defilement-control', this).removeClass('hidden');
|
|
|
106 |
});
|
|
|
107 |
$('body').on('mouseout', '.defilement-control-zone', function(event) {
|
|
|
108 |
$('.defilement-control', this).addClass('hidden');
|
|
|
109 |
});
|
2708 |
mathias |
110 |
$('#photo-placeholder').click(function(event) {
|
|
|
111 |
$('#fichier').click();
|
|
|
112 |
});
|
2745 |
aurelien |
113 |
|
|
|
114 |
$('.navigation-rue').on('click', this.surClicRueSuivantPrecedent.bind(this));
|
2707 |
mathias |
115 |
};
|
|
|
116 |
|
|
|
117 |
WidgetSaisieFlorileges.prototype.prechargerForm = function(infos) {
|
|
|
118 |
$('input[name="station"]').val(infos.station);
|
|
|
119 |
|
|
|
120 |
//console.log(infos.extension);
|
|
|
121 |
if (infos.extension) {
|
|
|
122 |
var ext = infos.extension;
|
|
|
123 |
if (ext.latitudeDebutRue && ext.longitudeDebutRue && ext.latitudeFinRue && ext.longitudeFinRue) {
|
|
|
124 |
this.okPourChargementCarte--;
|
|
|
125 |
this.latLngDebPre.lat = parseFloat(ext.latitudeDebutRue.valeur);
|
|
|
126 |
this.latLngDebPre.lng = parseFloat(ext.longitudeDebutRue.valeur);
|
|
|
127 |
this.latLngFinPre.lat = parseFloat(ext.latitudeFinRue.valeur);
|
|
|
128 |
this.latLngFinPre.lng = parseFloat(ext.longitudeFinRue.valeur);
|
|
|
129 |
this.prechargerRue();
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
var chpsARemplir = ['adresse', 'typoUrbaine', 'revetementSol', 'presenceZoneVegetalise', 'hauteurBatimentAvoisinant',
|
|
|
133 |
'intensiteGestion', 'periodiciteTraitementPhyto', 'dateArretTraitementPhyto', 'itineraireGestion'];
|
|
|
134 |
$.each(infos.extension, function(nomDuChp, value) {
|
|
|
135 |
if (chpsARemplir.indexOf(nomDuChp) >= 0) {
|
|
|
136 |
if ($('[name="' + nomDuChp + '"]').hasClass('slider')) {
|
|
|
137 |
$('select[name="' + nomDuChp + '"] option[value="' + value.valeur + '"]')
|
|
|
138 |
.attr('selected', 'selected');
|
|
|
139 |
var selectedIndexOptions = $('select[name="' + nomDuChp + '"]').prop('selectedIndex') + 1;
|
|
|
140 |
$('[name="' + nomDuChp + '"]').parent().find('.horizontal-slider').slider('value', selectedIndexOptions);
|
|
|
141 |
|
|
|
142 |
if (nomDuChp == 'periodiciteTraitementPhyto') {
|
|
|
143 |
$('[name="periodiciteTraitementPhyto"]').trigger('change');
|
|
|
144 |
}
|
|
|
145 |
} else {
|
|
|
146 |
$('[name="' + nomDuChp + '"]').val(value.valeur);
|
|
|
147 |
}
|
|
|
148 |
}
|
|
|
149 |
});
|
|
|
150 |
}
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
WidgetSaisieFlorileges.prototype.prechargerRue = function() {
|
|
|
154 |
if (this.okPourChargementCarte == 0) {
|
|
|
155 |
this.latLngDeb = new google.maps.LatLng(this.latLngDebPre.lat, this.latLngDebPre.lng);
|
|
|
156 |
this.markerDeb = undefined;
|
|
|
157 |
this.initialiserMarkerDeb();
|
2759 |
aurelien |
158 |
this.deplacerMarkerDeb(this.latLngDeb);
|
2707 |
mathias |
159 |
this.premierDeplacement = false;
|
|
|
160 |
this.latLngFin = new google.maps.LatLng(this.latLngFinPre.lat, this.latLngFinPre.lng);
|
|
|
161 |
this.initialiserMarkerFin();
|
2759 |
aurelien |
162 |
this.deplacerMarkerFin(this.latLngFin)
|
2707 |
mathias |
163 |
this.surDeplacementMarkerFin();
|
|
|
164 |
this.map.setZoom(16);
|
|
|
165 |
}
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
WidgetSaisieFlorileges.prototype.focusChampFormulaire = function() {
|
|
|
169 |
$('#structure').focus();
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
WidgetSaisieFlorileges.prototype.initialiserGoogleMap = function() {
|
|
|
173 |
var lthis = this;
|
|
|
174 |
|
|
|
175 |
this.latLngDeb = new google.maps.LatLng(46.30871, 2.54395);// Centre de la France
|
|
|
176 |
var options = {
|
|
|
177 |
zoom: 5,
|
|
|
178 |
center: this.latLngDeb,
|
|
|
179 |
mapTypeId: google.maps.MapTypeId.HYBRID,
|
|
|
180 |
mapTypeControlOptions: {
|
|
|
181 |
mapTypeIds: ['OSM',
|
|
|
182 |
google.maps.MapTypeId.ROADMAP,
|
|
|
183 |
google.maps.MapTypeId.HYBRID,
|
|
|
184 |
google.maps.MapTypeId.SATELLITE,
|
|
|
185 |
google.maps.MapTypeId.TERRAIN]}
|
|
|
186 |
};
|
|
|
187 |
|
|
|
188 |
// Ajout de la couche OSM à la carte
|
|
|
189 |
var osmMapType = new google.maps.ImageMapType({
|
|
|
190 |
getTileUrl: function(coord, zoom) {
|
|
|
191 |
return 'http://tile.openstreetmap.org/' + zoom + '/' + coord.x + '/' + coord.y + '.png';
|
|
|
192 |
},
|
|
|
193 |
tileSize: new google.maps.Size(256, 256),
|
|
|
194 |
isPng: true,
|
|
|
195 |
alt: 'OpenStreetMap',
|
|
|
196 |
name: 'OSM',
|
|
|
197 |
maxZoom: 19
|
|
|
198 |
});
|
|
|
199 |
|
|
|
200 |
// Création de la carte Google
|
|
|
201 |
this.map = new google.maps.Map(document.getElementById('map-canvas'), options); //affiche la google map dans la div map_canvas
|
|
|
202 |
this.map.mapTypes.set('OSM', osmMapType);
|
|
|
203 |
|
|
|
204 |
// Ajout de l'évènment sur click dans Carte
|
|
|
205 |
google.maps.event.addListener(this.map, 'click', this.surClickDansCarte.bind(this));
|
|
|
206 |
|
|
|
207 |
// Lorsque la carte est chargée, on vérifie si on peut précharger des données
|
|
|
208 |
google.maps.event.addListenerOnce(this.map, 'idle', function(){
|
|
|
209 |
if (lthis.obsId == '') {
|
|
|
210 |
// Initialisation du marker de début de rue
|
|
|
211 |
lthis.initialiserMarkerDeb();
|
|
|
212 |
// Tentative de geocalisation si aucune obs à précharger
|
|
|
213 |
if (lthis.obsId == '') {
|
|
|
214 |
lthis.tenterGeolocalisation();
|
|
|
215 |
}
|
|
|
216 |
} else {
|
|
|
217 |
lthis.okPourChargementCarte--;
|
|
|
218 |
lthis.prechargerRue();
|
|
|
219 |
}
|
|
|
220 |
});
|
|
|
221 |
|
|
|
222 |
$("#geolocaliser").on('click', this.geolocaliser.bind(this));
|
|
|
223 |
// Création du Geocoder
|
|
|
224 |
this.geocoder = new google.maps.Geocoder();
|
|
|
225 |
}
|
|
|
226 |
|
|
|
227 |
WidgetSaisieFlorileges.prototype.transformerEnSlider = function(selector) {
|
|
|
228 |
$(selector).each(function(index, el) {
|
|
|
229 |
// hide the element
|
|
|
230 |
$(el).addClass('slider-on');
|
|
|
231 |
|
|
|
232 |
// add the slider to each element
|
|
|
233 |
var slider = $( '<div class="slider-holder"><div class="horizontal-slider"></div></div>' ).
|
|
|
234 |
insertBefore( el ).find('.horizontal-slider').slider({
|
|
|
235 |
min: 1,
|
|
|
236 |
max: el.options.length,
|
|
|
237 |
range: 'min',
|
|
|
238 |
value: el.selectedIndex + 1,
|
|
|
239 |
slide: function(event, ui) {
|
|
|
240 |
el.selectedIndex = ui.value - 1;
|
|
|
241 |
slider.find('a').text(el.options[el.selectedIndex].text);
|
|
|
242 |
|
|
|
243 |
$(selector + ' option[selected="selected"]').removeAttr('selected');
|
|
|
244 |
$(selector + ' :nth-child('+ui.value+')').attr('selected', 'selected')
|
|
|
245 |
$(selector).valid();
|
|
|
246 |
},
|
|
|
247 |
stop: function() {
|
|
|
248 |
$(el).change();
|
|
|
249 |
}
|
|
|
250 |
});
|
|
|
251 |
|
|
|
252 |
slider.find('a').text(el.options[el.selectedIndex].text);
|
|
|
253 |
|
|
|
254 |
// Create a legend under the slider so we can see the options
|
|
|
255 |
var options = [];
|
|
|
256 |
for (var option in $(el).children()) {
|
|
|
257 |
if (!isNaN(parseInt(option))) {
|
|
|
258 |
options.push(el.options[option].text);
|
|
|
259 |
}
|
|
|
260 |
}
|
|
|
261 |
// the width of each legend/option
|
|
|
262 |
var width = (slider.width() / (options.length - 1));
|
|
|
263 |
|
|
|
264 |
// Add the legend. Half the width of the first and last options for display consistency.
|
|
|
265 |
slider.after('<div class="slider-legend"><p style="width:' + (width / 2) + 'px;text-align:left;">' +
|
|
|
266 |
options.join('</p><p style="width:' + width + 'px;">') +'</p></div>')
|
|
|
267 |
.parent().find('.slider-legend p:last-child').css('width', width / 2)
|
|
|
268 |
.css('text-align', 'right');
|
|
|
269 |
|
|
|
270 |
// if there are too many options so that the text is wider than the width, then hide the text
|
|
|
271 |
var lastChild = slider.parent().find('.slider-legend p:last-child');
|
|
|
272 |
if (lastChild[0].clientWidth < lastChild[0].scrollWidth) {
|
|
|
273 |
slider.parent().find('.slider-legend p');//.css('text-indent', '200%');
|
|
|
274 |
}
|
|
|
275 |
});
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
WidgetSaisieFlorileges.prototype.surChangementPeriodiciteTraitementPhyto = function() {
|
|
|
279 |
if ($('#periodicite-traitement-phyto').val() === 'jamais') {
|
|
|
280 |
$('#datp-zone').removeClass('hidden');
|
|
|
281 |
} else {
|
|
|
282 |
$('#datp-zone').addClass('hidden');
|
|
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
WidgetSaisieFlorileges.prototype.definirReglesFormValidator = function() {
|
|
|
287 |
$('#form-observateur').validate({
|
|
|
288 |
rules: {
|
|
|
289 |
courriel: {
|
|
|
290 |
required: true,
|
|
|
291 |
email: true},
|
|
|
292 |
courriel_confirmation: {
|
|
|
293 |
required: true,
|
|
|
294 |
equalTo: '#courriel'},
|
|
|
295 |
prenom: {
|
|
|
296 |
required: true},
|
|
|
297 |
nom: {
|
|
|
298 |
required: true},
|
|
|
299 |
personneStructure: {
|
|
|
300 |
required: true},
|
|
|
301 |
personneService: {
|
|
|
302 |
required: true}
|
|
|
303 |
}
|
|
|
304 |
});
|
|
|
305 |
$('#form-site').validate({
|
|
|
306 |
rules: {
|
|
|
307 |
station: {
|
|
|
308 |
required: true},
|
|
|
309 |
latitude : {
|
|
|
310 |
required: true,
|
|
|
311 |
range: [-90, 90]},
|
|
|
312 |
longitude: {
|
|
|
313 |
required: true,
|
|
|
314 |
range: [-180, 180]},
|
|
|
315 |
typoUrbaine: {
|
|
|
316 |
required: true},
|
|
|
317 |
revetementSol: {
|
|
|
318 |
required: true},
|
|
|
319 |
intensiteGestion: {
|
|
|
320 |
required: true},
|
|
|
321 |
periodiciteTraitementPhyto: {
|
|
|
322 |
required: true},
|
|
|
323 |
itineraireGestion: {
|
|
|
324 |
required: true}
|
|
|
325 |
}
|
|
|
326 |
});
|
|
|
327 |
$('#form-date').validate({
|
|
|
328 |
rules: {
|
|
|
329 |
date: {
|
|
|
330 |
required: true,
|
|
|
331 |
'dateCel' : true},
|
|
|
332 |
dateDerniereIntervention: {
|
|
|
333 |
required: true}
|
|
|
334 |
},
|
|
|
335 |
errorPlacement: function(error, element) {
|
|
|
336 |
if (element.attr('name') == 'date') {
|
|
|
337 |
element.parent('.input-prepend').after(error);
|
|
|
338 |
} else {
|
|
|
339 |
error.insertAfter(element);
|
|
|
340 |
}
|
|
|
341 |
}
|
|
|
342 |
});
|
|
|
343 |
$('#form-obs').validate({
|
|
|
344 |
rules: {
|
|
|
345 |
'taxon-liste': {
|
|
|
346 |
required: true},
|
|
|
347 |
'milieux[]': {
|
|
|
348 |
required: true,
|
|
|
349 |
minlength: 1},
|
|
|
350 |
hauteurPlante: {
|
|
|
351 |
required: true,
|
|
|
352 |
digits: true},
|
|
|
353 |
resistanceTraitementPhyto: {
|
|
|
354 |
required: true}
|
|
|
355 |
},
|
|
|
356 |
errorPlacement: function(error, element) {
|
|
|
357 |
if (element.attr('name') == 'milieux[]') {
|
|
|
358 |
error.insertAfter('#milieux-controls');
|
|
|
359 |
} else {
|
|
|
360 |
error.insertAfter(element);
|
|
|
361 |
}
|
|
|
362 |
}
|
|
|
363 |
});
|
|
|
364 |
}
|
|
|
365 |
|
|
|
366 |
WidgetSaisieFlorileges.prototype.validerFormulaire = function() {
|
|
|
367 |
var observateur = $('#form-observateur').valid(),
|
|
|
368 |
station = $('#form-site').valid(),
|
|
|
369 |
date = $('#form-date').valid(),
|
|
|
370 |
obs = $('#form-obs').valid(),
|
|
|
371 |
debRue = (this.latLngDeb == undefined) ? false : true,
|
|
|
372 |
finRue = (this.latLngFin == undefined) ? false : true;
|
|
|
373 |
var ok = (observateur && station && obs && date && debRue && finRue) ? true : false;
|
|
|
374 |
//console.log(observateur+'-'+station+'-'+obs+'-'+date+'-'+debRue+'-'+finRue);
|
|
|
375 |
return ok;
|
|
|
376 |
}
|
|
|
377 |
|
2708 |
mathias |
378 |
/*WidgetSaisieFlorileges.prototype.ajouterObs = function() {
|
2707 |
mathias |
379 |
if (this.validerFormulaire() == true) {
|
|
|
380 |
this.obsNbre = this.obsNbre + 1;
|
|
|
381 |
$('.obs-nbre').text(this.obsNbre);
|
|
|
382 |
$('.obs-nbre').triggerHandler('changement');
|
|
|
383 |
this.afficherObs();
|
|
|
384 |
this.stockerObsData();
|
|
|
385 |
this.supprimerMiniatures();
|
|
|
386 |
} else {
|
|
|
387 |
var debRue = (this.latLngDeb == undefined) ? false : true,
|
|
|
388 |
finRue = (this.latLngFin == undefined) ? false : true;
|
|
|
389 |
if (debRue == false || finRue == false) {
|
|
|
390 |
this.afficherPanneau('#dialogue-form-invalide-rue');
|
|
|
391 |
} else {
|
|
|
392 |
this.afficherPanneau('#dialogue-form-invalide');
|
|
|
393 |
}
|
|
|
394 |
}
|
2708 |
mathias |
395 |
}*/
|
2707 |
mathias |
396 |
|
|
|
397 |
WidgetSaisieFlorileges.prototype.afficherObs = function() {
|
|
|
398 |
var lthis = this;
|
|
|
399 |
|
|
|
400 |
var numNomSel = ($('#taxon-liste').val() == '?') ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(),
|
|
|
401 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
|
|
402 |
taxon = ($('#taxon-liste').val() == '?') ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
|
|
403 |
referentiel = (numNomSel == undefined) ? '' : '['+ this.nomSciReferentiel +']',
|
|
|
404 |
commune = $('#commune-nom').text(),
|
|
|
405 |
codeInsee = $('#commune-code-insee').text(),
|
|
|
406 |
lat = $('input[name="latitude"]').val(),
|
|
|
407 |
lng = $('input[name="longitude"]').val(),
|
|
|
408 |
date = $('#date').val(),
|
|
|
409 |
site = $('#station').val(),
|
|
|
410 |
revetement = $('#revetement-sol').val(),
|
|
|
411 |
intensiteGestion = $('#intensite-gestion').val(),
|
|
|
412 |
resistance = $('#resistance-traitement-phyto').val(),
|
|
|
413 |
milieux = this.getMilieux(),
|
|
|
414 |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + ".<br />" : '') + $('#notes').val();
|
|
|
415 |
|
|
|
416 |
$('#liste-obs').prepend(
|
|
|
417 |
'<div id="obs'+this.obsNbre+'" class="row-fluid obs obs'+this.obsNbre+'">'+
|
|
|
418 |
'<div class="span12">'+
|
|
|
419 |
'<div class="well">'+
|
|
|
420 |
'<div class="obs-action pull-right has-tooltip" data-placement="bottom" '+
|
|
|
421 |
'title="Supprimer cette observation de la liste à transmettre">'+
|
|
|
422 |
'<button class="btn btn-danger supprimer-obs" value="'+this.obsNbre+'" title="'+this.obsNbre+'">'+
|
|
|
423 |
'<i class="icon-trash icon-white"></i>'+
|
|
|
424 |
'</button>'+
|
|
|
425 |
'</div> '+
|
|
|
426 |
'<div class="row-fluid">'+
|
|
|
427 |
'<div class="span2 obs-miniatures">'+
|
|
|
428 |
this.ajouterImgMiniatureAuTransfert()+
|
|
|
429 |
'</div>'+
|
|
|
430 |
'<div class="span8">'+
|
|
|
431 |
'<ul class="unstyled">'+
|
|
|
432 |
'<li>'+
|
|
|
433 |
'<span class="nom-sci">' + taxon + '</span> ' +
|
|
|
434 |
this.formaterNumNomSel(numNomSel)+
|
|
|
435 |
'<span class="referentiel-obs">' + referentiel + '</span>' +
|
|
|
436 |
' observé à ' +
|
|
|
437 |
'<span class="commune">' + commune + '</span> ' +
|
|
|
438 |
'(' + codeInsee + ') [' + lat +' / ' + lng + ']' +
|
|
|
439 |
' le ' +
|
|
|
440 |
'<span class="date">' + date + '</span>' +
|
|
|
441 |
'</li>' +
|
|
|
442 |
'<li>' +
|
|
|
443 |
'<span>Site :</span> ' + site + ' ' + ' ; ' +
|
|
|
444 |
'<span>Revêtement au sol :</span> ' + revetement + ' ' + ' ; ' +
|
|
|
445 |
'<span>Intensité de gestion :</span> ' + intensiteGestion + ' ' + ' ; ' +
|
|
|
446 |
'<span>Milieu :</span> ' + milieux + ' ' + ' ; ' +
|
|
|
447 |
'<span>Résistance/Résilience :</span> ' + resistance + ' ' +
|
|
|
448 |
'</li>' +
|
|
|
449 |
'<li>' +
|
|
|
450 |
'Commentaires : ' + notes +
|
|
|
451 |
'</li>'+
|
|
|
452 |
'</ul>'+
|
|
|
453 |
'</div>'+
|
|
|
454 |
'</div>'+
|
|
|
455 |
'</div>'+
|
|
|
456 |
'</div>'+
|
|
|
457 |
'</div>');
|
|
|
458 |
$('#zone-liste-obs').removeClass("hidden").show();
|
|
|
459 |
}
|
|
|
460 |
|
|
|
461 |
WidgetSaisieFlorileges.prototype.stockerObsData = function() {
|
2708 |
mathias |
462 |
|
2707 |
mathias |
463 |
var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
|
|
|
464 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
|
|
465 |
numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val(),
|
|
|
466 |
nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
|
|
467 |
nomRet = nomHorsListe ? $('#taxon').data('nomRet') : this.taxons[numNomSel]['nom_ret'],
|
|
|
468 |
numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : this.taxons[numNomSel]['num_nom_ret'],
|
|
|
469 |
numTaxon = nomHorsListe ? $('#taxon').data('nt') : this.taxons[numNomSel]['num_taxon'],
|
|
|
470 |
famille = nomHorsListe ? $('#taxon').data('famille') : this.taxons[numNomSel]['famille'],
|
|
|
471 |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel,
|
|
|
472 |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + '. ' : '') + $('#notes').val();
|
|
|
473 |
|
|
|
474 |
$('#liste-obs').data('obsId'+ this.obsNbre, {
|
|
|
475 |
'date': $('#date').val(),
|
|
|
476 |
'notes': notes,
|
|
|
477 |
|
|
|
478 |
'station': $('#station').val(),
|
|
|
479 |
'latitude': $('#latitude').val(),
|
|
|
480 |
'longitude': $('#longitude').val(),
|
|
|
481 |
'commune_nom': $('#commune-nom').text(),
|
|
|
482 |
'commune_code_insee': $('#commune-code-insee').text(),
|
|
|
483 |
|
|
|
484 |
'nom_sel': nomSel,
|
|
|
485 |
'num_nom_sel': numNomSel,
|
|
|
486 |
'nom_ret': nomRet,
|
|
|
487 |
'num_nom_ret': numNomRet,
|
|
|
488 |
'num_taxon': numTaxon,
|
|
|
489 |
'famille': famille,
|
|
|
490 |
'referentiel': referentiel,
|
|
|
491 |
|
|
|
492 |
'milieu': this.getMilieux(),
|
|
|
493 |
|
|
|
494 |
// Ajout des champs images
|
|
|
495 |
'image_nom': this.getNomsImgsOriginales(),
|
|
|
496 |
|
|
|
497 |
// Ajout des champs étendus de l'obs
|
|
|
498 |
'obs_etendue': this.getObsChpEtendus()
|
|
|
499 |
});
|
|
|
500 |
//console.log($('#liste-obs').data('obsId'+obsNbre));
|
|
|
501 |
}
|
|
|
502 |
|
|
|
503 |
WidgetSaisieFlorileges.prototype.getObsChpEtendus = function() {
|
2708 |
mathias |
504 |
// super()
|
2750 |
aurelien |
505 |
var champs = WidgetSaisieSauvages.prototype.getObsChpEtendus.call(this);
|
2708 |
mathias |
506 |
|
|
|
507 |
var perceptionTechnicien = this.getPerceptionTechnicien();
|
2707 |
mathias |
508 |
if (perceptionTechnicien != undefined) {
|
|
|
509 |
champs.push(perceptionTechnicien);
|
|
|
510 |
}
|
|
|
511 |
|
|
|
512 |
return champs;
|
|
|
513 |
}
|
|
|
514 |
|
|
|
515 |
WidgetSaisieFlorileges.prototype.getPerceptionTechnicien = function() {
|
|
|
516 |
var perceptionTechnicien = undefined,
|
|
|
517 |
perceptions = [];
|
|
|
518 |
$('.cb-perception-technicien:checked').each(function() {
|
|
|
519 |
perceptions.push($(this).val());
|
|
|
520 |
});
|
|
|
521 |
if (perceptions.length > 0) {
|
|
|
522 |
var valeur = Array.prototype.slice.call(perceptions).join(', ');
|
|
|
523 |
perceptionTechnicien = {cle: 'perceptionTechnicien', label: "Perceptions par l'équipe", valeur: valeur};
|
|
|
524 |
}
|
|
|
525 |
return perceptionTechnicien;
|
|
|
526 |
}
|