File "usuario.js"
Full Path: C:/wamp64/www/INVENTALMACEN/js/demo/usuario.js
File size: 6.36 KB
MIME-type: text/plain
Charset: utf-8
$('#formlogin').submit(function (e) {
e.preventDefault();
var user = $.trim($('#user').val());
var password = $.trim($('#password').val());
if (user.length == "" || password.length == "") {
Swal.fire({
icon: "warning",
title: "DEBE INGRESA USUARIO Y/O CONTRASEÑA"
});
return false;
} else {
$.ajax({
url: "../controller/validarusuario.php",
type: "POST",
datatype: "json",
data: { user: user, password: password },
success: function (data) {
if (data == "null") {
Swal.fire({
icon: "error",
title: "Usuario y/o contraseña incorrecta",
text : "En caso de tener usuario y contraseña correcto, no puedrá realizar el ingreso debido a que los permisos del inventario se encuentran inactivos"
});
}
else {
Swal.fire({
icon: "success",
title: "!Conexion Exitosa¡",
confirmButtonColor: "#3085d6",
confirmButtonText: "Ingresar"
}).then((result) => {
if (result.value) {
window.location.href = "../views/index.php";
}
})
}
}
});
}
});
$('#formAutoriza').submit(function (e) {
e.preventDefault();
var userAutoriza = $.trim($('#userAutoriza').val());
var passwAutoriza = $.trim($('#passwAutoriza').val());
if (userAutoriza.length == "" || passwAutoriza.length == "") {
Swal.fire({
icon: "warning",
title: "DEBE INGRESA USUARIO Y/O CONTRASEÑA"
});
return false;
} else {
$.ajax({
url: "../controller/validarAutoriza.php",
type: "POST",
datatype: "json",
data: { userAutoriza: userAutoriza, passwAutoriza: passwAutoriza },
success: function (data) {
if (data == "null") {
Swal.fire({
icon: "error",
title: "Usuario y/o contraseña incorrecta",
});
} else {
Swal.fire({
icon: "success",
title: "!Registro Autorizado Exitoso¡",
confirmButtonColor: "#3085d6",
confirmButtonText: "Aceptar"
}).then((result) => {
if (result.value) {
$('#modalLoginForm').modal('hide');
$("#inpPeso").val('');
$("#inpUnidad").val('');
}
})
}
}
});
}
});
$('#formLogConsul').submit(function (e) {
e.preventDefault();
var userLogConsul = $.trim($('#userLogConsul').val());
var passLogConsul = $.trim($('#passLogConsul').val());
var superControl = $('#superControl').val();
if (userLogConsul.length == "" || passLogConsul.length == "") {
Swal.fire({
icon: "warning",
title: "DEBE INGRESA USUARIO Y/O CONTRASEÑA"
});
return false;
} else {
$.ajax({
url: "../controller/validarControlReg.php",
type: "POST",
datatype: "json",
data: { userLogConsul: userLogConsul, passLogConsul: passLogConsul },
success: function (data) {
if (data == "null") {
Swal.fire({
icon: "error",
title: "Usuario y/o contraseña incorrecta",
});
} else {
Swal.fire({
icon: "success",
title: "!Ingreso Exitoso¡",
confirmButtonColor: "#3085d6",
confirmButtonText: "Ingresar"
}).then((result) => {
if (result.value) {
switch (superControl) {
case '1':
window.location.href = "../views/controlPromedios.php";
brek;
case '2':
window.location.href = "../views/ajustes.php";
break;
}
}
})
}
}
});
}
});
$('#formLogControlReg').submit(function (e) {
e.preventDefault();
var userLogConsul = $.trim($('#userLogConsul').val());
var passLogConsul = $.trim($('#passLogConsul').val());
var superControl = $('#superControl').val();
if (userLogConsul.length == "" || passLogConsul.length == "") {
Swal.fire({
icon: "warning",
title: "DEBE INGRESA USUARIO Y/O CONTRASEÑA"
});
return false;
} else {
$.ajax({
url: "../controller/validarLoginControlReg.php",
type: "POST",
datatype: "json",
data: { userLogConsul: userLogConsul, passLogConsul: passLogConsul },
success: function (data) {
if (data == "null") {
Swal.fire({
icon: "error",
title: "Usuario y/o contraseña incorrecta",
});
} else {
Swal.fire({
icon: "success",
title: "!Ingreso Exitoso¡",
confirmButtonColor: "#3085d6",
confirmButtonText: "Ingresar"
}).then((result) => {
if (result.value) {
window.location.href = "../views/controlRegistros.php";
}
})
}
}
});
}
});