Primer commit del sistema avantika sin cambios
This commit is contained in:
146
javascript/functions.js
Executable file
146
javascript/functions.js
Executable file
@@ -0,0 +1,146 @@
|
||||
var DOC_ROOT = "../";
|
||||
var DOC_ROOT_TRUE = "../";
|
||||
var DOC_ROOT_SECTION = "../../";
|
||||
var WEB_ROOT = "http://" + document.location.hostname + "/html";
|
||||
var LOADER = "<img src='"+WEB_ROOT+"/images/load.gif'>";
|
||||
var LOADER2 = "<div align='center'><img src='"+WEB_ROOT+"/images/loading.gif'><br>Cargando...</div>";
|
||||
|
||||
Event.observe(window, 'load', function() {
|
||||
|
||||
if($('login_0'))
|
||||
{
|
||||
Event.observe($('login_0'), "click", LoginCheck);
|
||||
Event.observe($('password'), "keypress", function(evt) {
|
||||
if(evt.keyCode == 13)
|
||||
LoginCheck();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if($("logoutDiv") != undefined)
|
||||
Event.observe($('logoutDiv'), "click", Logout);
|
||||
|
||||
});
|
||||
|
||||
function LoginCheck()
|
||||
{
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/login.php',
|
||||
{
|
||||
parameters: $('loginForm').serialize(true),
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
{
|
||||
Redirect('/homepage');
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowStatus(splitResponse[1]);
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function AddNewVtaDiv(){
|
||||
|
||||
grayOut(true);
|
||||
$('fviewVta').show();
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/ventas.php',{
|
||||
method:'post',
|
||||
parameters: {type: "addVenta"},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
|
||||
FViewOffSetVta(response);
|
||||
|
||||
$("divIframe").innerHTML = '<iframe width="1000" height="700" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+WEB_ROOT+'/ventas-nueva">Lo sentimos, pero tu navegador no soporta IFRAMES.</iframe>';
|
||||
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//AddNewVtaDiv
|
||||
|
||||
function ToogleStatusDiv()
|
||||
{
|
||||
$('centeredDiv').toggle();
|
||||
grayOut(false);
|
||||
}
|
||||
|
||||
function ToogleStatusDivOnPopup()
|
||||
{
|
||||
$('centeredDivOnPopup').toggle();
|
||||
}
|
||||
|
||||
function HideDivOnPopup()
|
||||
{
|
||||
if($('centeredDivOnPopup') != undefined){
|
||||
if($('centeredDivOnPopup').style.display == "none")
|
||||
HideFview();
|
||||
else
|
||||
$('centeredDivOnPopup').hide();
|
||||
}else if($('centeredDiv') != undefined){
|
||||
if($('centeredDiv').style.display == "none")
|
||||
HideFview();
|
||||
else
|
||||
$('centeredDiv').hide();
|
||||
}else if($('fview') != undefined){
|
||||
HideFview();
|
||||
}
|
||||
}
|
||||
|
||||
function Redirect(page)
|
||||
{
|
||||
window.location = WEB_ROOT+page;
|
||||
}
|
||||
|
||||
function RedirectRoot(page)
|
||||
{
|
||||
window.location = page;
|
||||
}
|
||||
|
||||
function Logout()
|
||||
{
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/logout.php',
|
||||
{
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[1] == "login")
|
||||
RedirectRoot(WEB_ROOT);
|
||||
else
|
||||
window.location.href = WEB_ROOT + "/facturas";
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
|
||||
function HideFview(){
|
||||
$('fview').hide();
|
||||
grayOut(false);
|
||||
}
|
||||
|
||||
function HideFviewVta(){
|
||||
$('fviewVta').hide();
|
||||
grayOut(false);
|
||||
}
|
||||
|
||||
function HideFviewCobro(){
|
||||
$('fviewCobro').hide();
|
||||
grayOut(false);
|
||||
|
||||
if($('btnCobVta')!= undefined)
|
||||
$("btnCobVta").removeAttribute('disabled');
|
||||
}
|
||||
Reference in New Issue
Block a user