extranet/www/js/greffescmd.js
2010-07-06 14:15:55 +00:00

54 lines
1.4 KiB
JavaScript

$(document).ready(function()
{
$('.changeEtat').each(function(){
var $link = $(this);
var $dialog = $('<div></div>')
.dialog({
autoOpen: false,
title: $link.attr('title'),
width: 400,
height: 200,
open: function(event, ui) {
$(this).load($link.attr('href'));
},
buttons: {
'Placer la commande en erreur': function() {
$.post($('#formComment').attr('action'),
{
idCommande: $('input[name=idCommande]').val(),
commentaire: $('textarea[name=commentaire]').val(),
statutCommande: $('input[name=statutCommande]').val(),
submit: 'comment'
},
function(data){
if(data==1){ $dialog.dialog('close'); }
else $('#message').html('Erreur...');
}
);
},
'Annuler': function() { $(this).dialog('close'); }
}
});
$link.click(function() {
$dialog.dialog('open');
return false;
});
});
$('.changeEtatC').change(function(){
var newEtat = $(this).val();
var name = $(this).attr('name');
$.post('./?page=saisieajax&q=greffescmd',{ changeEtat: newEtat },
function(data){ $('select[name='+name+']').replaceWith(data); }
);
});
$('.rs').click(function(e){
e.preventDefault();
var item = $(this);
$.post(item.attr('href'), { siren: item.attr('alt') },
function(data){ item.replaceWith('<b>'+data+'</b>'); }
);
});
});