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 = { ...@@ -179,14 +179,6 @@ let persona = {
reject("Error al registrar personal") reject("Error al registrar personal")
} }
}) })
fetchSo('../PersonaServlet?accion=registrarPersona', json)
.then((data) => {
resolve(data)
})
.catch((data) => {
reject(data)
})
}) })
}, },
editar() { editar() {
...@@ -319,6 +311,7 @@ let asignarEventos = () => { ...@@ -319,6 +311,7 @@ let asignarEventos = () => {
persona persona
.registrar() .registrar()
.then((data) => { .then((data) => {
if (data.status) {
customSwal customSwal
.alert('¡Exito!', data.message, 'success') .alert('¡Exito!', data.message, 'success')
.then(() => { .then(() => {
...@@ -327,6 +320,10 @@ let asignarEventos = () => { ...@@ -327,6 +320,10 @@ let asignarEventos = () => {
.then(() => { .then(() => {
persona.listar() persona.listar()
}) })
} else {
customSwal.alert('¡Error!', data.message, 'error')
}
}) })
.catch((data) => { .catch((data) => {
customSwal.alert('¡Error!', data.message, 'error') customSwal.alert('¡Error!', data.message, 'error')
...@@ -395,8 +392,19 @@ let asignarEventos = () => { ...@@ -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() jqueryValidateConfig()
persona.listar() persona.listar()
asignarEventos() asignarEventos()
limpiarCajasTexto() limpiarCajasTexto()
validateInputs()
\ No newline at end of file
...@@ -262,6 +262,7 @@ ...@@ -262,6 +262,7 @@
<!--js plantilla--> <!--js plantilla-->
<!--mi js--> <!--mi js-->
<script src="../js/lib/validate_inputs.js" type="text/javascript"></script>
<script src="../js/general.js" type="text/javascript"></script> <script src="../js/general.js" type="text/javascript"></script>
<script src="../js/pages/persona.js" type="text/javascript"></script> <script src="../js/pages/persona.js" type="text/javascript"></script>
<!--mi js--> <!--mi js-->
......
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