extranet/www/js/greffescmd.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2010-05-07 15:48:45 +00:00
$(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() {
2010-07-06 14:15:55 +00:00
$.post($('#formComment').attr('action'),
2010-05-07 15:48:45 +00:00
{
2010-07-06 14:15:55 +00:00
idCommande: $('input[name=idCommande]').val(),
commentaire: $('textarea[name=commentaire]').val(),
statutCommande: $('input[name=statutCommande]').val(),
submit: 'comment'
2010-05-07 15:48:45 +00:00
},
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');
2010-07-06 14:15:55 +00:00
$.post('./?page=saisieajax&q=greffescmd',{ changeEtat: newEtat },
function(data){ $('select[name='+name+']').replaceWith(data); }
2010-05-07 15:48:45 +00:00
);
});
$('.rs').click(function(e){
e.preventDefault();
2010-07-06 14:15:55 +00:00
var item = $(this);
$.post(item.attr('href'), { siren: item.attr('alt') },
function(data){ item.replaceWith('<b>'+data+'</b>'); }
2010-05-07 15:48:45 +00:00
);
});
});