Primer commit del sistema avantika sin cambios
This commit is contained in:
169
javascript/atributos.js
Executable file
169
javascript/atributos.js
Executable file
@@ -0,0 +1,169 @@
|
||||
Event.observe(window, 'load', function() {
|
||||
|
||||
AddEditProductosListeners = function(e) {
|
||||
|
||||
var el = e.element();
|
||||
var del = el.hasClassName('spanDelete');
|
||||
var id = el.identify();
|
||||
|
||||
if(del == true){
|
||||
DeleteAtributoPopup(id);
|
||||
return;
|
||||
}
|
||||
|
||||
del = el.hasClassName('spanEdit');
|
||||
|
||||
if(del == true)
|
||||
EditAtributoPopup(id);
|
||||
|
||||
}
|
||||
|
||||
if($('contenido')!= undefined)
|
||||
$('contenido').observe("click", AddEditProductosListeners);
|
||||
|
||||
if($("addAtributo") != undefined)
|
||||
$('addAtributo').observe("click", function(){ AddAtributoDiv(1); });
|
||||
|
||||
});
|
||||
|
||||
function AddAtributoDiv(id){
|
||||
|
||||
grayOut(true);
|
||||
|
||||
if(id == 0){
|
||||
$('fview').hide();
|
||||
grayOut(false);
|
||||
return;
|
||||
}
|
||||
$('fview').show();
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/atributos.php',{
|
||||
method:'post',
|
||||
parameters: {type: "addAtributo"},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
FViewOffSet(response);
|
||||
Event.observe($('btnSave'), "click", AddAtributo);
|
||||
Event.observe($('fviewclose'), "click", function(){ HideFview(); });
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//AddAtributoDiv
|
||||
|
||||
function AddAtributo(){
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/atributos.php',
|
||||
{
|
||||
method:'post',
|
||||
parameters: $('frmAgregarAtributo').serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "fail"){
|
||||
ShowStatusPopUp(splitResponse[1]);
|
||||
}else{
|
||||
ShowStatusPopUp(splitResponse[1]);
|
||||
$('contenido').innerHTML = splitResponse[2];
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//AddAtributo
|
||||
|
||||
function EditAtributoPopup(id){
|
||||
|
||||
grayOut(true);
|
||||
$('fview').show();
|
||||
if(id == 0){
|
||||
$('fview').hide();
|
||||
grayOut(false);
|
||||
return;
|
||||
}
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/atributos.php',{
|
||||
method:'post',
|
||||
parameters: {type: "editAtributo", atributoId:id},
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
|
||||
FViewOffSet(response);
|
||||
Event.observe($('closePopUpDiv'), "click", function(){ HideFview(); });
|
||||
Event.observe($('btnUpdate'), "click", EditAtributo);
|
||||
},
|
||||
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
|
||||
});
|
||||
|
||||
}//EditAtributoPopup
|
||||
|
||||
function EditAtributo(){
|
||||
|
||||
var form = $('frmEditarAtributo').serialize();
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/atributos.php', {
|
||||
method:'post',
|
||||
parameters: $('frmEditarAtributo').serialize(),
|
||||
onSuccess: function(transport){
|
||||
var response = transport.responseText || "no response text";
|
||||
var splitResponse = response.split("[#]");
|
||||
|
||||
if(splitResponse[0] == "fail")
|
||||
{
|
||||
ShowStatusPopUp(splitResponse[1])
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowStatusPopUp(splitResponse[1])
|
||||
$('contenido').innerHTML = splitResponse[2];
|
||||
HideFview();
|
||||
}
|
||||
},
|
||||
onFailure: function(){ alert('Something went wrong...') }
|
||||
});
|
||||
|
||||
}//EditAtributo
|
||||
|
||||
function DeleteAtributoPopup(id){
|
||||
|
||||
var message = "Realmente deseas eliminar este atributo?";
|
||||
|
||||
if(!confirm(message)){
|
||||
return;
|
||||
}
|
||||
|
||||
new Ajax.Request(WEB_ROOT+'/ajax/atributos.php',{
|
||||
method:'post',
|
||||
parameters: {type: "deleteAtributo", atributoId: 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...') }
|
||||
|
||||
});
|
||||
|
||||
}//DeleteAtributoPopup
|
||||
|
||||
function ViewValores(id){
|
||||
|
||||
var obj = $('valores_'+id);
|
||||
|
||||
if(obj.style.display == "none")
|
||||
obj.style.display = "";
|
||||
else
|
||||
obj.style.display = "none";
|
||||
}
|
||||
Reference in New Issue
Block a user