Commit a0f99254 by Felipe Escala Torres

[ADD] masive user edit

parent 4d60bdba
......@@ -20,4 +20,6 @@ public interface CursoDAO {
public JSONObject eliminarCurso(JSONObject datos) throws Exception;
public JSONObject asignarCurso(JSONObject datos) throws Exception;
public JSONObject eliminarCursos(JSONObject datos) throws Exception;
}
......@@ -28,4 +28,10 @@ public interface UsuarioDAO {
public JSONObject editarUsuarios(JSONObject datos) throws Exception;
public JSONObject validarUsuario(JSONObject datos) throws Exception;
public JSONObject validarCursos(JSONObject datos) throws Exception;
public JSONObject editarGradoMasivo(JSONObject datos) throws Exception;
public JSONObject listarDetalle(JSONObject datos) throws Exception;
}
......@@ -19,7 +19,7 @@ import so.aulavirtual.utilities.ResponseHelper;
* @author sistem17user
*/
public class CursoMysqlDAO implements CursoDAO {
@Override
public JSONObject listarCursos(JSONObject datos) throws Exception {
JSONObject jreturn = new JSONObject();
......@@ -95,7 +95,7 @@ public class CursoMysqlDAO implements CursoDAO {
jreturn.put("draw", datos.getInt("draw"));
return jreturn;
}
@Override
public JSONObject listarCurso(JSONObject datos) throws Exception {
JSONObject jreturn;
......@@ -151,7 +151,7 @@ public class CursoMysqlDAO implements CursoDAO {
jreturn = new JSONObject(response);
return jreturn;
}
@Override
public JSONObject eliminarCurso(JSONObject datos) throws Exception {
JSONObject jreturn;
......@@ -175,7 +175,7 @@ public class CursoMysqlDAO implements CursoDAO {
response.setMessage("Curso eliminado correctamente");
} else {
response.setStatus(false);
response.setMessage("Error al eliminar cursos");
response.setMessage("Error al eliminar curso");
}
} catch (Exception e) {
e.printStackTrace();
......@@ -201,7 +201,7 @@ public class CursoMysqlDAO implements CursoDAO {
jreturn = new JSONObject(response);
return jreturn;
}
@Override
public JSONObject asignarCurso(JSONObject datos) throws Exception {
JSONObject jreturn;
......@@ -261,4 +261,60 @@ public class CursoMysqlDAO implements CursoDAO {
jreturn = new JSONObject(response);
return jreturn;
}
@Override
public JSONObject eliminarCursos(JSONObject datos) throws Exception {
JSONObject jreturn;
JSONArray lista;
JSONObject data = new JSONObject();
Connection con = null;
PreparedStatement pst = null;
ResultSet rSet = null;
int rs = 0;
String sql;
ResponseHelper response = new ResponseHelper();
try {
con = MysqlDAOFactory.obtenerConexion(GeneralVariables.nameDB);
con.setAutoCommit(false);
JSONArray deletedItems = datos.getJSONArray("lista");
sql = " delete from mdl_user_enrolments "
+ " where id = ? ";
pst = con.prepareStatement(sql);
for (int i = 0; i < deletedItems.length(); i++) {
pst.setInt(1, deletedItems.getInt(i));
pst.addBatch();
}
lista = new JSONArray(pst.executeBatch());
if (lista.length() > 0) {
con.commit();
response.setStatus(true);
response.setMessage("Curso eliminado correctamente");
} else {
response.setStatus(false);
response.setMessage("Error al eliminar cursos");
}
} catch (Exception e) {
e.printStackTrace();
response.setStatus(false);
response.setMessage("Error --->" + e.getMessage());
} finally {
try {
if (rSet != null) {
rSet.close();
}
if (pst != null) {
pst.close();
}
if (con != null) {
con.close();
}
} catch (Exception e) {
e.printStackTrace();
response.setStatus(false);
response.setMessage("Error --->" + e.getMessage());
}
}
jreturn = new JSONObject(response);
return jreturn;
}
}
......@@ -58,4 +58,14 @@ public class CursoService {
return obj;
}
public JSONObject eliminarCursos(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.eliminarCursos(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
}
......@@ -98,4 +98,24 @@ public class UsuarioService {
return obj;
}
public JSONObject editarGradoMasivo(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.editarGradoMasivo(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject listarDetalle(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.listarDetalle(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
}
......@@ -37,6 +37,9 @@ public class CursoServlet extends HttpServlet {
case "asignarCurso":
asignarCurso(request, response);
break;
case "eliminarCursos":
eliminarCursos(request, response);
break;
default:
break;
}
......@@ -85,4 +88,14 @@ public class CursoServlet extends HttpServlet {
out.println(rs);
}
private void eliminarCursos(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
CursoService srv = new CursoService();
String jsonString = request.getParameter("json");
JSONObject json = new JSONObject(jsonString);
JSONObject rs = srv.eliminarCursos(json);
out.println(rs);
}
}
......@@ -49,6 +49,12 @@ public class UsuarioServlet extends HttpServlet {
case "validarUsuario":
validarUsuario(request, response);
break;
case "editarGradoMasivo":
editarGradoMasivo(request, response);
break;
case "listarDetalle":
listarDetalle(request, response);
break;
default:
break;
}
......@@ -132,4 +138,27 @@ public class UsuarioServlet extends HttpServlet {
JSONObject rs = srv.validarUsuario(json);
out.println(rs);
}
private void editarGradoMasivo(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
UsuarioService srv = new UsuarioService();
String jsonString = request.getParameter("json");
JSONObject json = new JSONObject(jsonString);
JSONObject rs = srv.editarGradoMasivo(json);
out.println(rs);
}
private void listarDetalle(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
UsuarioService srv = new UsuarioService();
String jsonString = request.getParameter("json");
JSONObject json = new JSONObject(jsonString);
json.put("draw", Integer.parseInt(request.getParameter("draw")));
json.put("length", Integer.parseInt(request.getParameter("length")));
json.put("start", Integer.parseInt(request.getParameter("start")));
JSONObject rs = srv.listarDetalle(json);
out.println(rs);
}
}
......@@ -109,18 +109,12 @@ label {
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}
@media screen and (max-width: 769px){
.button-plus{
padding-top: 11px;
}
}
#txtBusqProductos::-webkit-search-cancel-button{
position:relative;
padding: 2px;
}
@media (min-width: 768px){
.sidebar{
width: 200px;
......@@ -190,6 +184,10 @@ label {
padding: 3px 15px;
}
.table-sm > thead > tr > th, .table-sm > tbody > tr > th, .table-sm > tfoot > tr > th, .table-sm > thead > tr > td, .table-sm > tbody > tr > td, .table-sm > tfoot > tr > td {
padding: 5px 15px;
}
.table{
width: 100% !important;
}
......@@ -243,7 +241,7 @@ a.disabled {
}
}
.footer.fixed {
.ffooter {
position: fixed;
bottom: 0;
left: 0;
......@@ -252,6 +250,33 @@ a.disabled {
padding: 10px 20px;
background: white;
border-top: 1px solid #e7eaec;
margin-left: 200px;
margin-left: 200px;
}
.ffooter-xl{
margin-left: 56px;
}
@media (max-width:768px) {
.ffooter {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 1000;
padding: 8px 5px;
background: white;
border-top: 1px solid #e7eaec;
margin-left: 0px;
font-size: 13px;
text-align: center;
}
}
table.display tbody tr:hover td {
background-color: #AAB7D1 !important;
}
.modal-header[class*=bg-] {
padding: 10px 15px;
}
\ No newline at end of file
This image diff could not be displayed because it is too large. You can view the blob instead.
......@@ -17,9 +17,9 @@
const capitalizeWords = str => str.split(' ').map((word, i, arr) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ')
function msnSuccess(message, action) {
function msnSuccess(message, action, charge) {
var final = action || function () {};
bootbox.dialog({
let bbxSuccess = bootbox.dialog({
className: "dialogExtraSmall",
title: "<i class='ace-icon fa fa-tags white'></i> <span class='white'>Notificación</span>",
headerClass: "modal-bg-success",
......@@ -34,6 +34,11 @@
}
}
});
if (charge !== undefined) {
bbxSuccess.init(() => {
charge()
})
}
}
function msnError(message, action) {
......@@ -168,6 +173,27 @@
$("#" + id).parent().unblock();
}
};
var loader = {
iniciarLoader: function () {
$.blockUI({
message: '<i class="icon-spinner9 spinner position-left" style="font-size:25px"></i>',
overlayCSS: {
backgroundColor: '#1b2024',
opacity: 0.95,
cursor: 'wait'
},
css: {
border: 0,
color: '#fff',
padding: 0,
backgroundColor: 'transparent'
}
});
},
terminarLoader: function () {
$.unblockUI();
}
};
function load(msg) {
$.blockUI({
......@@ -187,33 +213,10 @@
}
});
}
function unload() {
$.unblockUI();
}
var loader = {
iniciarLoader: function () {
$.blockUI({
message: '<i class="icon-spinner9 spinner position-left" style="font-size:25px"></i>',
overlayCSS: {
backgroundColor: '#1b2024',
opacity: 0.95,
cursor: 'wait'
},
css: {
border: 0,
color: '#fff',
padding: 0,
backgroundColor: 'transparent'
}
});
},
terminarLoader: function () {
$.unblockUI();
}
};
$(window).resize(function () {
const width = $(window).width();
if (width < 1589 && width > 1199) {
......@@ -237,4 +240,10 @@
}
});
}
if (width < 959) {
$('.pace-done').addClass('sidebar-xs')
} else {
$('.pace-done').removeClass('sidebar-xs')
}
});
......@@ -18,7 +18,7 @@
let letter = String.fromCharCode(event.which).toLowerCase()
let valid =
-1 !== exp.indexOf(letter) ||
9 === keyCode || 13 === keyCode ||
9 === keyCode || 13 === keyCode ||
37 !== whichCode && 37 === keyCode ||
39 === keyCode && 39 !== whichCode ||
8 === keyCode ||
......@@ -29,7 +29,7 @@
});
el.addEventListener('drop', (event) => {
let word = event.dataTransfer.getData("text")
let word = event.dataTransfer.getData("text").toLowerCase()
let conta = 0;
for (var i = 0; i < word.length; i++) {
let letter = word.charAt(i)
......@@ -42,7 +42,7 @@
}
})
el.addEventListener('paste', (event) => {
let word = event.clipboardData.getData('text');
let word = event.clipboardData.getData('text').toLowerCase()
let conta = 0;
for (var i = 0; i < word.length; i++) {
let letter = word.charAt(i)
......@@ -54,7 +54,6 @@
event.preventDefault()
}
})
})
}
......
......@@ -6,5 +6,4 @@
} else {
window.location = 'mantenimientoUsuario.jsp'
}
console.log(dataRequest);
})(Cookies);
\ No newline at end of file
/* global Papa */
const DOMEvents = {
cargarCSV() {
$('#btnCargar').click(function () {
var archivo;
$('#filePrueba').parse({
header: true,
dynamicTyping: false,
encoding: "ISO-8859-1",
before: function (file) {
archivo = file;
}
});
Papa.parse(archivo, {
header: true,
dynamicTyping: false,
encoding: "ISO-8859-1",
complete: function (results) {
$('#txtJson').html(JSON.stringify(results.data, undefined, 2))
}
})
})
}
}
\ No newline at end of file
......@@ -34,12 +34,7 @@
<div class="media">
<div class="media-body media-middle">
<span class="media-heading text-semibold" style="font-size:15px">${capitalizeWords(datos)} </span>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li><a class="logOut"><i class="fa fa-sign-out"></i></a></li>
</ul>
</div>
</div>
</div>`;
let banner2 = `<a class="dropdown-toggle" data-toggle="dropdown">
<img src="../img/${capitalizeWords(datos).charAt(0)}.jpg" alt="">
......
......@@ -78,7 +78,7 @@
<!-- Footer -->
<div class="footer text-muted text-center footerText">
<label id="footerDate">&copy; </label><a href="#">&nbsp; Solicitud de Requerimientos</a> por <a href="#">Área Sistemas TIC</a>
<label id="footerDate">&copy; </label><a href="#">&nbsp; Registro de usuarios Aulavirtual</a> por <a href="#">Área Sistemas TIC</a>
</div>
<!-- /footer -->
......
......@@ -23,7 +23,7 @@
<div class="col-sm-12 col-md-12 col-lg-7 col-centered">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-books"></i>&nbsp; REGISTRO DE CURSOS</h6>
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-books"></i>&nbsp; REGISTRO DE CURSOS &nbsp;<b class="fa fa-arrow-right"></b>&nbsp;<i id="dataUser">&nbsp; </i></h6>
<div class="heading-elements">
<ul class="icons-list">
<li><a data-action="collapse"></a></li>
......@@ -90,15 +90,19 @@
</div>
<div class="col-sm-12 col-md-12 col-lg-7 col-centered">
<div class="col-sm-12 col-md-12 col-lg-6 col-lg-offset-3">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; LISTADO DE CURSOS</h6>
<div class="heading-elements">
<button type="button" id="btnEliminar" class="btn bg-danger-700 border-danger-800 btn-xs hide"><i class="glyphicon glyphicon-trash"></i>&nbsp; Eliminar</button>
</div>
</div>
<div class="table-responsive">
<table class="table dataTable table-striped table-hover table-sm table-bordered" id="tblCursos">
<table class="table display dataTable table-striped table-hover table-sm table-bordered" id="tblCursos">
<thead>
<tr>
<th class="text-center"><input type="checkbox" class="ckTitle"></th>
<th class="text-center"></th>
<th class="text-center">GRADO</th>
<th class="text-center">CURSO</th>
......
......@@ -19,7 +19,7 @@
<%@include file="templates/header-body.jsp" %>
<!-- content -->
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-4 col-centered">
<div class="col-sm-12 col-md-12 col-lg-6 col-lg-offset-3">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; BÚSQUEDAS DE USUARIOS</h6>
......@@ -32,7 +32,19 @@
<div class="panel-body" id="panelSearch">
<form id="frmBusqRequ" onsubmit="return false" autocomplete="off">
<div class="row">
<div class='col-md-12' id="div-busq-tipo">
<div class="col-md-4">
<div class="form-group">
<label>
TIPO BÚSQUEDA:
</label>
<span class="asterisk">(*)</span>
<select class="form-control" id="cboTipoBusqueda">
<option value="1">DNI</option>
<option value="2">GRADO</option>
</select>
</div>
</div>
<div class='col-md-8' id="div-busq-dni">
<div class="form-group">
<label>
DNI:
......@@ -41,6 +53,28 @@
<input class="form-control" id="txtDni" name="txtDni" placeholder="Ingrese DNI" maxlength="8" autofocus="">
</div>
</div>
<div class='col-md-4 hide' id="div-busq-nivel">
<div class="form-group">
<label>
NIVEL:
</label>
<span class="asterisk">(*)</span>
<select class="form-control" id="cboNivelBusqueda">
<option value="">[SELECCIONE]</option>
</select>
</div>
</div>
<div class='col-md-4 hide' id="div-busq-grado">
<div class="form-group">
<label>
GRADO:
</label>
<span class="asterisk">(*)</span>
<select class="form-control" id="cboGradoBusqueda" disabled="">
<option value="">[SELECCIONE]</option>
</select>
</div>
</div>
</div>
</form>
<div class="row">
......@@ -62,31 +96,33 @@
</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-10 col-lg-offset-1">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; LISTADO DE USUARIOS</h6>
<div class="heading-elements">
<button type="button" id="btnNuevo" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Nuevo Usuario</button>
</div>
<div class="col-lg-11 col-centered">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; LISTADO DE USUARIOS</h6>
<div class="heading-elements">
<button type="button" id="btnNuevo" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Nuevo Usuario</button>
<button type="button" id="btnModificar" class="btn bg-teal-600 border-teal-700 btn-xs hide"><i class="glyphicon glyphicon-pencil"></i>&nbsp; Modificar Usuarios</button>
</div>
</div>
<div class="table-responsive">
<table class="table display dataTable table-striped table-hover table-sm table-bordered" id="tblUsuarios">
<thead>
<tr>
<th class="text-center"><input type="checkbox" class="ckTitle"></th>
<th class="text-center"></th>
<th class="text-center">USUARIO</th>
<th class="text-center">DNI</th>
<th class="text-center">TIPO</th>
<th class="text-center">CORREO</th>
<th class="text-center">ROL</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="table-responsive">
<table class="table dataTable table-striped table-hover table-sm table-bordered" id="tblUsuarios">
<thead>
<tr>
<th class="text-center"></th>
<th class="text-center">USUARIO</th>
<th class="text-center">DNI</th>
<th class="text-center">TIPO</th>
<th class="text-center">CORREO</th>
<th class="text-center">ROL</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
......
<!-- Footer -->
<div class="footer fixed">
<div class="ffooter">
<label id="footerDate" style="margin-bottom: 0px">&copy; </label><a href="#">&nbsp; Registro de usuarios Aulavirtual</a> por <a href="#">rea Sistemas TIC</a>
</div>
<!-- /footer -->
......
......@@ -2,7 +2,6 @@
<div class="navbar navbar-default header-highlight">
<div class="navbar-header" style="position: relative;">
<a class="navbar-brand" href="../vistas/main.jsp" id="logistica"></a>
<!--<img src="../img/oie_transparent.png" alt="">-->
<ul class="nav navbar-nav visible-xs-block">
<li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li>
<li><a class="sidebar-mobile-main-toggle"><i class="icon-paragraph-justify3"></i></a></li>
......@@ -17,8 +16,8 @@
<ul class="nav navbar-nav navbar-right">
<li class="dropdown language-switch">
<a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="../plantilla/assets/images/flags/pe.png" class="position-left" alt="">
Sistemas
<!--<img src="../plantilla/assets/images/flags/pe.png" class="position-left" alt="">-->
SISTEMAS
<span class="caret"></span>
</a>
......
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