extranet/www/js/annonces.js

110 lines
2.8 KiB
JavaScript
Raw Normal View History

function annonceAction(action, source, idan, siret) {
$.post('index.php',
{
page: 'saisieajax',
q: 'annonces/'+action,
idan: idan,
siret: siret,
source: source
},
function(data){ $('#result').html(data); }
);
}
$(document).ready(function(){
//Gestion boite dialog mandataire
$('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....");
annonceAction('delete', source, idan, siret);
},
'Quitter': function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').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,
2010-06-25 14:07:19 +00:00
width: 650,
height: 500,
modal: true,
closeOnEscape: false,
open: function(event, ui) {
$(this).html('Chargement...').load(href);
},
buttons: {
2010-08-31 06:59:31 +00:00
'Enregistrer': function() {
if ($('form#saisie').length){
$('form#saisie').submit();
}
},
'Quitter': function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').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(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
});
});