Primer commit del sistema avantika sin cambios
This commit is contained in:
439
javascript/pedidos-editar.js
Executable file
439
javascript/pedidos-editar.js
Executable file
@@ -0,0 +1,439 @@
|
||||
function EditPedido(){
|
||||
|
||||
$("type").value = "saveEditPedido";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').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{
|
||||
ShowStatusPopUp(splitResponse[1]);
|
||||
HideFview();
|
||||
$("loader").hide();
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//EditPedido
|
||||
|
||||
function EditPedido2(){
|
||||
|
||||
$("type").value = "saveEditPedido2";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').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{
|
||||
ShowStatusPopUp(splitResponse[1]);
|
||||
HideFview();
|
||||
$("loader").hide();
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//EditPedido
|
||||
|
||||
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: $('frmEditarPedido').serialize(),
|
||||
onLoading: function(){
|
||||
$("tblLoader").innerHTML = LOADER;
|
||||
},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
$("tblLoader").innerHTML = '';
|
||||
|
||||
if(splitResponse[0] == "ok")
|
||||
$("tblProporcion").innerHTML = splitResponse[1];
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function AddTalla(){
|
||||
|
||||
$("type").value = "addTalla";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos-agregar.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').serialize(),
|
||||
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];
|
||||
}else{
|
||||
ShowStatus(splitResponse[1]);
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function DelTalla(key){
|
||||
|
||||
$("key").value = key;
|
||||
$("type").value = "delTalla";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos-agregar.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').serialize(),
|
||||
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];
|
||||
}else{
|
||||
ShowStatus(splitResponse[1]);
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function AddColor(){
|
||||
|
||||
$("type").value = "addColor";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos-agregar.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').serialize(),
|
||||
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];
|
||||
}else{
|
||||
ShowStatus(splitResponse[1]);
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function DelColor(key){
|
||||
|
||||
$("key").value = key;
|
||||
$("type").value = "delColor";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos-agregar.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').serialize(),
|
||||
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];
|
||||
}else{
|
||||
ShowStatus(splitResponse[1]);
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//PRODUCTOS
|
||||
|
||||
function AddProducto(){
|
||||
|
||||
$("type").value = "addProdEdit";
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: $('frmEditarPedido').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];
|
||||
|
||||
$("modelo").value = "";
|
||||
$("productoId").value = "";
|
||||
$("prodCatId").value = "";
|
||||
$("prodSubcatId").value = "";
|
||||
$("enumAtributos").innerHTML = "";
|
||||
LoadProporciones();
|
||||
}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;
|
||||
}
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/pedidos.php',{
|
||||
method:'post',
|
||||
parameters: {type:"deleteProdEdit", 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];
|
||||
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//DeleteProducto
|
||||
|
||||
function SearchProducto()
|
||||
{
|
||||
var modelo = $("modelo").value;
|
||||
var proveedorId = $("proveedorId").value;
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/suggest_gral.php',
|
||||
{
|
||||
parameters: {codigoBarra:modelo, type:"prodByCode", proveedorId:proveedorId},
|
||||
method:'post',
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "ok"){
|
||||
$("enumAtributos").innerHTML = splitResponse[1];
|
||||
$("productoId").value = splitResponse[2];
|
||||
$("prodCatId").value = splitResponse[3];
|
||||
$("prodSubcatId").value = splitResponse[4];
|
||||
LoadProporciones();
|
||||
}else
|
||||
{
|
||||
ShowStatus(splitResponse[1]);
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//SearchProducto
|
||||
|
||||
//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();
|
||||
|
||||
}
|
||||
|
||||
function CheckKey(e){
|
||||
|
||||
if(window.event)
|
||||
keyCode = window.event.keyCode;
|
||||
else if(e)
|
||||
keyCode=e.which;
|
||||
|
||||
if(keyCode == 13){
|
||||
SearchProducto();
|
||||
}
|
||||
|
||||
}//CheckKey
|
||||
Reference in New Issue
Block a user