2011-11-07 13:20:19 +00:00
|
|
|
$(document).ready(function(){
|
2011-09-28 08:44:27 +00:00
|
|
|
|
2011-12-14 14:27:21 +00:00
|
|
|
$('#tabs').delegate('select.criteres', 'change', function(e){
|
|
|
|
e.stopPropagation();
|
|
|
|
set($(this).attr('name'), $(this, ':selected').val());
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#tabs').delegate('input[type=checkbox].criteres', 'click', function(e){
|
|
|
|
e.stopPropagation();
|
2011-12-14 15:14:50 +00:00
|
|
|
set($(this).attr('name'), $(this).val());
|
2011-12-14 14:27:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('#tabs').delegate('input[type=radio].criteres', 'click', function(e){
|
|
|
|
e.stopPropagation();
|
2011-12-14 15:14:50 +00:00
|
|
|
set($(this).attr('name'), $(this).val());
|
2011-12-14 13:23:37 +00:00
|
|
|
});
|
2011-11-07 13:20:19 +00:00
|
|
|
|
2011-12-14 14:27:21 +00:00
|
|
|
$('#tabs').delegate('input[type=text].criteres', 'blur', function(e){
|
|
|
|
e.stopPropagation();
|
2011-12-14 15:14:50 +00:00
|
|
|
set($(this).attr('name'), $(this).val());
|
2011-12-14 14:27:21 +00:00
|
|
|
});
|
2011-11-07 13:20:19 +00:00
|
|
|
|
2011-12-14 15:48:35 +00:00
|
|
|
$('#tabs').delegate('a.interval', 'click', function(e){
|
2011-12-15 09:17:26 +00:00
|
|
|
e.preventDefault();
|
2011-12-14 15:48:35 +00:00
|
|
|
var key = $(this).attr('id');
|
2011-12-15 13:08:03 +00:00
|
|
|
var values = $('input[name='+key+'1]').val() + ',' + $('input[name='+key+'2]').val();
|
2011-12-14 15:48:35 +00:00
|
|
|
set(key, values);
|
2011-12-15 09:17:26 +00:00
|
|
|
return false;
|
2011-12-14 15:48:35 +00:00
|
|
|
});
|
2011-12-14 14:27:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function set(key, value)
|
|
|
|
{
|
2011-12-14 15:30:46 +00:00
|
|
|
$('#comptage').css('display', 'none');
|
|
|
|
$('#attente').css('display', 'block');
|
2011-12-14 14:27:21 +00:00
|
|
|
$.post('/comptage', { cle:key, valeur:value}, function(data, status) {
|
|
|
|
$('#count').html(data.count);
|
2011-12-14 15:10:16 +00:00
|
|
|
$('#insee').html(data.insee);
|
2011-12-14 15:59:30 +00:00
|
|
|
$('#attente').css('display', 'none');
|
|
|
|
$('#comptage').css('display', 'block');
|
|
|
|
}, 'json')
|
|
|
|
.error(function(){ alert('error'); });
|
2011-12-14 14:27:21 +00:00
|
|
|
}
|
|
|
|
|