89 lines
2.3 KiB
JavaScript
Raw Normal View History

2011-11-07 13:20:19 +00:00
$(document).ready(function(){
2011-09-28 08:44:27 +00:00
$(".tooltip").qtip();
$('.tooltip').each(function(){
var title = $(this).attr('title');
var width = $(this).attr('wdth');
$(this).attr('title', '');
$(this).qtip({
solo:true,
content: title,
style: {
width: width,
classes: "ui-tooltip-cream"
},
position: {
at: $('#at').val(),
my: $('#my').val(),
viewport: $(window),
adjust: {
method: $('#adjust_method').val(),
x: parseInt($('#adjust_x').val(), 10) || 0,
y: parseInt($('#adjust_y').val(), 10) || 0
}
}
});
});
$(function() {
2011-12-16 16:50:07 +00:00
$( ".datepicker" ).datepicker({
showOn: "button",
buttonImage: "/themes/default/images/calendar.png",
buttonImageOnly: true
});
$( ".datepicker" ).datepicker( "option", "dateFormat", "yymmdd" );
});
2011-12-19 16:48:03 +00:00
$('.printCritere').change(function(){
$('#'+$(this, ':selected').val()).css('display', 'block');
})
2011-12-16 09:00:12 +00:00
$('.accordion .head').click(function() {
$(this).next().toggle('slow');
return false;
}).next().hide();
2011-12-14 14:27:21 +00:00
$('#tabs').delegate('select.criteres', 'change', function(e){
e.stopPropagation();
set($(this).attr('name'), $(this, ':selected').val());
2011-12-19 16:48:03 +00:00
$('#'+$(this).attr('name')).css('background-color', '#97DB70');
2011-12-14 14:27:21 +00:00
});
$('#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');
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)
{
$('.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);
$('.attente').css('display', 'none');
$('.comptage').css('display', 'block');
2011-12-14 15:59:30 +00:00
}, 'json')
.error(function(){ alert('error'); });
2011-12-14 14:27:21 +00:00
}