extranet/public/themes/default/scripts/finance.js

101 lines
2.6 KiB
JavaScript

$(document).ready(function()
{
$('select[name=typeBilan]').on('change', function(e){
e.preventDefault();
$(this).parent('form').submit();
});
$('select[name=mil]').on('change', function(e){
e.preventDefault();
$(this).parent('form').submit();
});
$('a.tooltip').qtip({
style: { width: 500, classes: 'qtip-dark' },
position: { my: 'top left', at: 'bottom left' },
content: { attr: 'title'}
});
$('area.detailsgraphique').qtip({
style: { width: 170 },
position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' } },
content: { attr: 'title'}
});
$('a.rTip').each(function(){
$(this).qtip({
position: { at: 'right center', my: 'right center', adjust: { x: -20 } },
show: { solo: true },
style: { tip: true, width: 400, classes: 'qtip-light' },
content: {
text: "Chargement...", title: { text: $(this).attr('name') },
ajax: { url: $(this).attr('rel') }
}
});
});
$('a img.sTip').each(function(){
$(this).qtip({
position: { at: 'right center', my: 'right center', adjust: { x: -20 } },
show: { solo: true },
style: { width: 420, classes: 'qtip-light' },
content: {
text: "Chargement...",
title: { text: "Evolution - " + $(this).attr('title') },
ajax: { url: $(this).attr('rel') }
}
});
});
$('#bilanClient').on('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;
});
$('a#xls').on('click', function(e){
e.preventDefault();
var objet = $(this).parent();
objet.html('Construction du fichier...');
var url = $(this).attr('href');
$.post( url, function (data, textStatus) {
if( data=='' || data=='FALSE' || textStatus=='timeout' ) {
data = 'La construction du fichier a échoué.<br/>';
}
objet.html(data);
});
});
});
function formEnvoiBilanSubmit(){
var url = $('#formEnvoiBilan').attr('action');
$.post(url, $('#formEnvoiBilan').serialize(),
function (data, textStatus) {
if (textStatus!='success'){
$('#dialogbilanclient').html('Erreur');
} else {
$('#dialogbilanclient').html(data);
}
}
);
}