Commit caf66a6a by Alonso Moreno Postigo

[ADD] v0.1

parent 94d0c27c
(function (a) {
a.fn.validCampo = function (b) {
a(this).on({
keypress: function (a) {
var c = a.which,
d = a.keyCode,
e = String.fromCharCode(c).toLowerCase(),
f = b;
(-1 != f.indexOf(e) || 9 == d || 37 != c && 37 == d || 39 == d && 39 != c || 8 == d || 46 == d && 46 != c) && 161 != c || a.preventDefault()
}
})
}
})(jQuery);
\ No newline at end of file
......@@ -179,14 +179,6 @@ let persona = {
reject("Error al registrar personal")
}
})
fetchSo('../PersonaServlet?accion=registrarPersona', json)
.then((data) => {
resolve(data)
})
.catch((data) => {
reject(data)
})
})
},
editar() {
......@@ -319,14 +311,19 @@ let asignarEventos = () => {
persona
.registrar()
.then((data) => {
customSwal
.alert('¡Exito!', data.message, 'success')
.then(() => {
$('#modal_registrar_persona').modal('hide')
})
.then(() => {
persona.listar()
})
if (data.status) {
customSwal
.alert('¡Exito!', data.message, 'success')
.then(() => {
$('#modal_registrar_persona').modal('hide')
})
.then(() => {
persona.listar()
})
} else {
customSwal.alert('¡Error!', data.message, 'error')
}
})
.catch((data) => {
customSwal.alert('¡Error!', data.message, 'error')
......@@ -395,8 +392,19 @@ let asignarEventos = () => {
}
})
}
let validateInputs = () => {
$(document.querySelector('#txt-busqueda')).validCampo('abcdefghijklmnñopqrstuvwxyzáéíóú ')
$(document.querySelector('#txt_numero_documento')).validCampo('1234567890')
$(document.querySelector('#txt_apellidos')).validCampo('abcdefghijklmnñopqrstuvwxyzáéíóú ')
$(document.querySelector('#txt_nombres')).validCampo('abcdefghijklmnñopqrstuvwxyzáéíóú ')
$(document.querySelector('#txt_edad')).validCampo('1234567890')
$(document.querySelector('#txt_correo')).validCampo('abcdefghijklmnñopqrstuvwxyz1234567890._-@ ')
}
jqueryValidateConfig()
persona.listar()
asignarEventos()
limpiarCajasTexto()
\ No newline at end of file
limpiarCajasTexto()
validateInputs()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment