$(document).ready(function() { $('a.annonceDelete').click(function(e){ e.preventDefault(); var title = $(this).attr('title'); var href = $(this).attr('href'); var dialogOpts = { bgiframe: true, title: title, width: 350, height: 150, modal: true, open: function(event, ui) { $(this).html('Chargement...').load(href); }, buttons: { 'Supprimer': function() { var siret = $('input:hidden[name=siret]').val(); var idan = $('input:hidden[name=idan]').val(); var source = $('input:hidden[name=source]').val(); $('#result').html("Suppression en cours...."); $.post('index.php', { page: 'saisieajax', q: 'annonces/delete', idan: idan, siret: siret, source: source }, function(data){ $('#result').html(data); } ); }, 'Quitter': function() { $(this).dialog('close'); } }, close: function() { $('#dialog').remove(); } }; $('
').dialog(dialogOpts); }); $('a.annonceEdit').click(function(e){ e.preventDefault(); var title = $(this).attr('title'); var href = $(this).attr('href'); var dialogOpts = { bgiframe: true, title: title, width: 650, height: 500, modal: true, closeOnEscape: false, open: function(event, ui) { $(this).html('Chargement...').load(href); }, buttons: { 'Enregistrer': function() { if ($('form#saisie').length){ $('form#saisie').submit(); } }, 'Quitter': function() { $(this).dialog('close'); } }, close: function() { $('#dialog').remove(); } }; $('
').dialog(dialogOpts); }); $('a.annonceCopy').click(function(e){ e.preventDefault(); var title = $(this).attr('title'); var href = $(this).attr('href'); var dialogOpts = { bgiframe: true, title: title, width: 350, height: 200, modal: true, closeOnEscape: false, open: function(event, ui) { $(this).html('Chargement...').load(href); }, buttons: { 'Dupliquer': function() { var siretIn = $('input[name=siretIn]').val(); var siretOut = $('input[name=siretOut]').val(); var idan = $('input:hidden[name=idan]').val(); var source = $('input:hidden[name=source]').val(); $('#result').html("Copie en cours...."); $.post('index.php', { page: 'saisieajax', q: 'annonces/copy', idan: idan, siretIn: siretIn, siretOut: siretOut, source: source }, function(data){ $('#result').html(data); } ); }, 'Quitter': function() { $(this).dialog('close'); } }, close: function() { $('#dialog').remove(); } }; $('
').dialog(dialogOpts); }); });