156 lines
4.2 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
2011-12-20 15:22:09 +00:00
$(".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,
2011-12-20 15:22:09 +00:00
classes: "ui-tooltip-dark"
},
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
}
}
});
});
2011-12-29 10:15:14 +00:00
slider = $( ".slider-range" ).slider({
range: true,
create: function(event, ui) {
var max = $("#"+$(this).attr('input')).attr('max');
var min = $("#"+$(this).attr('input')).attr('min');
$(this).slider( "option", "min", min );
$(this).slider( "option", "max", max );
},
values : [0, 100000000000000],
slide: function( event, ui ) {
var name = $(this).attr('input');
$( "#"+name ).val( ui.values[ 0 ] + " , " + ui.values[ 1 ] );
},
step: 10,
stop: function( event, ui ) {
var name = $(this).attr('input');
set(name, ui.values[ 0 ] + "," + ui.values[ 1 ]);
},
});
2011-12-29 10:15:14 +00:00
var dates = $( ".from, .to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 2,
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "maxDate" : "minDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
2011-12-29 10:15:14 +00:00
$( ".datepicker" ).datepicker();
$( ".datepicker" ).datepicker( "option", "dateFormat", "yymmdd" );
2011-12-20 15:22:09 +00:00
$('.printCritere').click(function(){
var name = $(this).attr('name');
2011-12-21 14:36:58 +00:00
var block = $('.'+$(this).attr('name')).css('display');
2011-12-20 15:22:09 +00:00
if(block == 'block') {
$(this).css('background-image', 'url(/themes/default/images/ajouter.png)');
2011-12-21 14:36:58 +00:00
$('.'+name).hide('slide');
2011-12-20 15:22:09 +00:00
}
else {
$(this).css('background-image', 'url(/themes/default/images/moins.png)');
2011-12-21 14:36:58 +00:00
$('.'+name).show('slide');
2011-12-20 15:22:09 +00:00
}
2011-12-29 10:17:15 +00:00
});
2011-12-29 10:15:14 +00:00
$( "#accordion" ).accordion({
autoHeight: false,
navigation: true
2011-12-20 15:22:09 +00:00
});
2011-12-29 10:15:14 +00:00
$( "#sortable" ).sortable({
placeholder: "ui-state-highlight"
2011-12-20 15:22:09 +00:00
});
2011-12-29 10:15:14 +00:00
$( "#sortable" ).disableSelection();
2011-12-20 15:22:09 +00:00
2011-12-29 10:15:14 +00:00
$( ".column" ).sortable({
connectWith: ".column"
});
2011-12-20 15:22:09 +00:00
2011-12-29 10:15:14 +00:00
$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
.find( ".portlet-header" )
.addClass( "ui-widget-header ui-corner-all" )
.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
.end()
.find( ".portlet-content" );
2011-12-20 15:22:09 +00:00
2011-12-29 10:15:14 +00:00
$( ".portlet-header .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
2011-12-20 15:22:09 +00:00
});
2011-12-29 10:15:14 +00:00
$( ".column" ).disableSelection();
2011-12-16 09:00:12 +00:00
2011-12-14 14:27:21 +00:00
$('#tabs').delegate('select.criteres', 'change', function(e){
2011-12-20 15:22:09 +00:00
var valeur = $(this, ':selected').val();
2011-12-14 14:27:21 +00:00
e.stopPropagation();
2011-12-20 15:22:09 +00:00
if(valeur == 'tous') {
$('#'+$(this).attr('name')).css('background-color', '');
} else {
$('#'+$(this).attr('name')).css('background-color', '#CCF8D2'); }
2011-12-14 14:27:21 +00:00
set($(this).attr('name'), $(this, ':selected').val());
2011-12-20 15:22:09 +00:00
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
}