129 lines
2.9 KiB
JavaScript
Executable File
129 lines
2.9 KiB
JavaScript
Executable File
Event.observe(window, 'load', function() {
|
|
|
|
AddEditEnviosListeners = function(e) {
|
|
|
|
var el = e.element();
|
|
var del = el.hasClassName('spanDelete');
|
|
var id = el.identify();
|
|
|
|
if(del == true){
|
|
aplicarDevolucion(id);
|
|
return;
|
|
}
|
|
|
|
del = el.hasClassName('spanAdd');
|
|
if(del == true){
|
|
aplicarBonificacion(id);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if($('contenido')!= undefined)
|
|
$('contenido').observe("click", AddEditEnviosListeners);
|
|
|
|
});
|
|
|
|
function aplicarBonificacion(id)
|
|
{
|
|
grayOut(true);
|
|
if(id == 0)
|
|
{
|
|
$('fview').hide();
|
|
grayOut(false);
|
|
return;
|
|
}
|
|
$('fview').show();
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/evaluar-pedidos.php',
|
|
{
|
|
method:'post',
|
|
parameters: {type: "addPago", id:id, menu: "bonificacion"},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
|
|
FViewOffSet(response);
|
|
Event.observe($('btnAddPago'), "click", AddPago);
|
|
Event.observe($('fviewclose'), "click", function(){ HideFview(); });
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}
|
|
|
|
function AddPago()
|
|
{
|
|
var message = "Realmente deseas aplicar ésta bonificacion?";
|
|
|
|
if(!confirm(message)){
|
|
return;
|
|
}
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/evaluar-pedidos.php',
|
|
{
|
|
method:'post',
|
|
parameters: $('addPagoForm').serialize(true),
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
if(splitResponse[0] == "ok")
|
|
{
|
|
ShowStatusPopUp(splitResponse[1]);
|
|
$('contenido').innerHTML = splitResponse[2];
|
|
aplicarBonificacion(0);
|
|
}
|
|
else
|
|
{
|
|
ShowStatusPopUp(splitResponse[1]);
|
|
}
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}
|
|
|
|
function aplicarDevolucion(id)
|
|
{
|
|
alert(id);
|
|
var message = "Realmente deseas aplicar ésta devolucion?";
|
|
|
|
if(!confirm(message)){
|
|
return;
|
|
}
|
|
new Ajax.Request(WEB_ROOT+'/ajax/evaluar-pedidos.php',
|
|
{
|
|
method:'post',
|
|
parameters: {type: "saveDevolucion", id:id, menu: "devolucion"},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
|
|
FViewOffSet(response);
|
|
Event.observe($('btnAddPago'), "click", AddPago);
|
|
Event.observe($('fviewclose'), "click", function(){ HideFview(); });
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
|
|
}//DeleteEnvioPopup
|
|
|
|
/*function Search()
|
|
{
|
|
new Ajax.Request(WEB_ROOT+'/ajax/envios.php',
|
|
{
|
|
method:'post',
|
|
parameters: $('frmSearch').serialize(),
|
|
onLoading: function(){
|
|
$('loadBusqueda').show();
|
|
$('contenido').innerHTML = '';
|
|
},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
$('loadBusqueda').hide();
|
|
|
|
if(splitResponse[0] == "ok")
|
|
$('contenido').innerHTML = splitResponse[1];
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}*/ |