2011-07-12 15:13:03 +00:00

126 lines
3.0 KiB
JavaScript

$(document).ready( function()
{
$('select[name=typeBilan]').live('change', function(e){
e.preventDefault();
$(this).parent('form').submit();
});
$('select[name=mil]').live('change', function(e){
e.preventDefault();
$(this).parent('form').submit();
});
$('a.tooltip').each(function(){
var title = $(this).attr('title');
$(this).attr('title', '');
$(this).qtip( {
content: title,
style: { width: 500, name: 'dark' },
position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' } }
});
});
$('area.detailsgraphique').qtip({
content: $('area.detailsgraphique').title,
style: { name: 'cream', width: 170 },
position: {
corner: { target: 'bottomMiddle',
tooltip: 'topMiddle' } }
});
$('a.tab').click(function(){
var contenu_aff = $(this).attr('title');
if ($(this).hasClass('active')){
$('.tab').removeClass('active');
$('.content').css('display', 'block');
} else {
$('.tab').removeClass('active');
$(this).addClass('active');
$('.content').slideUp();
$("#"+contenu_aff).slideDown();
}
});
$('.rTip').each(function(){
$(this).qtip({
content: {
text: 'Chargement...',
url: $(this).attr('rel'),
title: { text: $(this).attr('name')}
},
position: {
corner: {
target: 'leftMiddle',
tooltip: 'rightMidle'
}
},
style: {
tip: true,
border: { width: 1, radius: 0 },
name: 'light',
width: 400
}
});
});
$('img.sTip').each(function(){
$(this).qtip({
content: {
text: 'Chargement...',
url: $(this).attr('rel'),
title: { text: 'Evolution - ' + $(this).attr('title')}
},
position: {
corner: {
target: 'leftMiddle',
tooltip: 'rightMiddle'
}
},
style: {
tip: true,
border: { width: 1, radius: 0 },
name: 'light',
width: 420
}
});
});
$('#bilanClient').live('click', function(e){
e.preventDefault();
var url = $(this).attr('href');
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 550,
height: 450,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(url);
},
buttons: {
Valider: function() { formEnvoiBilanSubmit(); },
Annuler: function() { $(this).dialog('close'); }
},
close: function() { $('#dialogbilanclient').remove(); }
};
$('<div id="dialogbilanclient"></div>').dialog(dialogOpts);
return false;
});
});
function formEnvoiBilanSubmit(){
var url = $('#formEnvoiBilan').attr('action');
$.post(url, $('#formEnvoiBilan').serialize(),
function (data, textStatus) {
if (textStatus!='success'){
$('#dialogbilanclient').html('Erreur');
} else {
$('#dialogbilanclient').html(data);
}
}
);
}