93 lines
2.1 KiB
JavaScript
Executable File
93 lines
2.1 KiB
JavaScript
Executable File
Event.observe(window, 'load', function() {
|
|
|
|
AddEditSolicitudListeners = function(e) {
|
|
var el = e.element();
|
|
var del = el.hasClassName('spanDelete');
|
|
var id = el.identify();
|
|
if(del == true)
|
|
{
|
|
DeleteSolicitudPopup(id);
|
|
return;
|
|
}
|
|
}
|
|
|
|
$('contenido').observe("click", AddEditSolicitudListeners);
|
|
});
|
|
|
|
function AddSolicitudDiv(id)
|
|
{
|
|
grayOut(true);
|
|
if(id == 0)
|
|
{
|
|
$('fview').hide();
|
|
grayOut(false);
|
|
return;
|
|
}
|
|
$('fview').show();
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/reportes-invparcial.php',
|
|
{
|
|
method:'post',
|
|
parameters: {type: "addSolicitud"},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
FViewOffSet(response);
|
|
Event.observe($('agregarSolicitud'), "click", AddSolicitud);
|
|
Event.observe($('fviewclose'), "click", function(){ AddSolicitudDiv(0); });
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}
|
|
|
|
function AddSolicitud()
|
|
{
|
|
new Ajax.Request(WEB_ROOT+'/ajax/reportes-invparcial.php',
|
|
{
|
|
method:'post',
|
|
parameters: $('agregarSolicitudForm').serialize(true),
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
|
|
var splitResponse = response.split("[#]");
|
|
if(splitResponse[0] == "fail")
|
|
{
|
|
ShowStatusPopUp(splitResponse[1]);
|
|
}
|
|
else
|
|
{
|
|
ShowStatus(splitResponse[1]);
|
|
$('contenido').innerHTML = splitResponse[2];
|
|
HideFview();
|
|
}
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
}
|
|
|
|
function DeleteSolicitudPopup(id)
|
|
{
|
|
var message = "Realmente deseas eliminar esta solicitud?";
|
|
if(!confirm(message))
|
|
{
|
|
return;
|
|
}
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/reportes-invparcial.php',
|
|
{
|
|
method:'post',
|
|
parameters: {type: "deleteSolicitud", id: id},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
|
|
var splitResponse = response.split("[#]");
|
|
ShowStatus(splitResponse[1])
|
|
$('contenido').innerHTML = splitResponse[2];
|
|
HideFview();
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
|
|
|
|
} |