Primer commit del sistema avantika sin cambios
This commit is contained in:
311
javascript/pedidos-revivir.js
Executable file
311
javascript/pedidos-revivir.js
Executable file
@@ -0,0 +1,311 @@
|
||||
function AddPedido(){
|
||||
|
||||
$("type").value = "savePedido";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmAgregarPedido').serialize(),
|
||||
onLoading: function(){
|
||||
$("loader").show();
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
location.href = WEB_ROOT + "/pedidos";
|
||||
}else{
|
||||
ShowStatus(splitResponse[1]);
|
||||
HideFview();
|
||||
$("loader").hide();
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//AddPedido
|
||||
|
||||
function CancelPedido(id){
|
||||
|
||||
var message = "Realmente deseas cancelar este pedido?";
|
||||
|
||||
if(!confirm(message)){
|
||||
return;
|
||||
}
|
||||
|
||||
location.href = WEB_ROOT + "/pedidos";
|
||||
|
||||
}
|
||||
|
||||
function LoadSubcats(){
|
||||
|
||||
var idCat = $("prodCatId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"loadLineas", prodCatId:idCat},
|
||||
onLoading: function(){
|
||||
$("enumLineas").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("enumLineas").innerHTML = splitResponse[1];
|
||||
|
||||
LoadModelos();
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//LoadSubcats
|
||||
|
||||
|
||||
function LoadModelos(){
|
||||
|
||||
$("modelo").value = '';
|
||||
$("productoId").value = '';
|
||||
|
||||
LoadAtributos();
|
||||
|
||||
}//LoadModelos
|
||||
|
||||
function LoadAtributos(){
|
||||
|
||||
var idProd = $("productoId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"loadAtributos", productoId:idProd},
|
||||
onLoading: function(){
|
||||
$("enumAtributos").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("enumAtributos").innerHTML = splitResponse[1];
|
||||
|
||||
LoadProporciones();
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//LoadAtributos
|
||||
|
||||
function LoadProporciones(){
|
||||
|
||||
var idProd = $("productoId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"loadProporciones", productoId:idProd},
|
||||
onLoading: function(){
|
||||
$("tblProporcion").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("tblProporcion").innerHTML = splitResponse[1];
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//LoadProporciones
|
||||
|
||||
function UpdateProporcion(){
|
||||
|
||||
$("type").value = "updateProporcion";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmAgregarPedido').serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("tblProporcion").innerHTML = splitResponse[1];
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//PRODUCTOS
|
||||
|
||||
function AddProducto(){
|
||||
|
||||
$("type").value = "addProducto";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: $('frmAgregarPedido').serialize(),
|
||||
onLoading: function(){
|
||||
$("productos").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("productos").innerHTML = splitResponse[1];
|
||||
$("listDist").innerHTML = splitResponse[2];
|
||||
}else{
|
||||
ShowStatus(splitResponse[1]);
|
||||
$("productos").innerHTML = splitResponse[2];
|
||||
HideFview();
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//AddProducto
|
||||
|
||||
function DeleteProducto(id){
|
||||
|
||||
var message = "Realmente deseas eliminar este producto?";
|
||||
|
||||
if(!confirm(message)){
|
||||
return;
|
||||
}
|
||||
|
||||
$("type").value = "deleteProducto";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"deleteProducto", k:id},
|
||||
onLoading: function(){
|
||||
$("productos").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("productos").innerHTML = splitResponse[1];
|
||||
$("listDist").innerHTML = splitResponse[2];
|
||||
}
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//DeleteProducto
|
||||
|
||||
//Suggest Proveedores
|
||||
|
||||
function SuggestProveedor()
|
||||
{
|
||||
var vNombre = $("proveedor").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/suggest_gral.php',
|
||||
{
|
||||
parameters: {nombre: vNombre, type: "proveedor"},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
|
||||
$('sugProvDiv').show();
|
||||
$('sugProvDiv').innerHTML = response;
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
|
||||
function FillInfoProv(id){
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/proveedores.php',
|
||||
{
|
||||
parameters: {type: "fillInfoProv", proveedorId:id},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("proveedorId").value = splitResponse[1];
|
||||
$("proveedor").value = splitResponse[2];
|
||||
}
|
||||
|
||||
CloseSugProv();
|
||||
LoadModelos();
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function CloseSugProv(){
|
||||
|
||||
$('sugProvDiv').hide();
|
||||
|
||||
}
|
||||
|
||||
//Suggest Productos
|
||||
|
||||
function SuggestProducto()
|
||||
{
|
||||
var idProveedor = $("proveedorId").value;
|
||||
var idProdCat = $("prodCatId").value;
|
||||
var idProdSubcat = $("prodSubcatId").value;
|
||||
var vNombre = $("modelo").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/suggest_gral.php',
|
||||
{
|
||||
parameters: {nombre:vNombre, type:"producto", proveedorId:idProveedor, prodCatId:idProdCat, prodSubcatId:idProdSubcat},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
|
||||
$('sugProdDiv').show();
|
||||
$('sugProdDiv').innerHTML = response;
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
}
|
||||
|
||||
function FillInfoProd(id){
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/productos.php',
|
||||
{
|
||||
parameters: {type: "fillInfoProd", productoId:id},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("productoId").value = splitResponse[1];
|
||||
$("modelo").value = splitResponse[2];
|
||||
}
|
||||
|
||||
CloseSugProd();
|
||||
LoadAtributos();
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function CloseSugProd(){
|
||||
|
||||
$('sugProdDiv').hide();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user