Commit ad99244e by Walter Rosado Estrada

checkbox es visible para modulos

parent b7f3cb97
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<context-root>/moduloSeguridad</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
......@@ -230,11 +230,13 @@
}
function crearFormEdicion(data) {
console.log(data);
var tipo = data["tipo"];
var codigo = data["codigo"];
var jerarquia = data["jerarquia"];
var nombre = data["nombre"];
var url = data["url"];
var visible = data["esVisible"];
var txturl;
if (tipo === 1 || jerarquia === 4) {
txturl = url.slice(0, -4);
......@@ -284,6 +286,12 @@
<span class="input-group-addon"><div class="" style="color:#848484">.jsp</div></span>
</div>
</div>
<div class='frm col-md-6' id="formEsVisible">
<label style="font-size: small">
Es visible:
</label>
<input id="chkVisible" name="chkEsVisible" class="icp-opts form-control switch" type="checkbox"/>
</div>
<div class='col-md-12 hide' id="formHide">
&nbsp;
</div>
......@@ -345,6 +353,13 @@
if (jerarquia === 2 || jerarquia === 3) {
validarDependenciaEditar(data);
}
if(visible){
$("#chkVisible").prop("checked", true);
}else{
$("#chkVisible").removeAttr("checked");
}
validarFormulario(jerarquia);
submitKey('formEditarMenu', '.buttonOk');
validCaracForm();
......@@ -420,13 +435,15 @@
} else {
txturl = url;
}
var json = {
"codigo": data.codigo,
"jerarquia": data.jerarquia,
"tipo": tipoMenu,
"url": txturl,
"nombre": $('#editarNombre').val(),
"icono": $('#editarIcono').val()
"icono": $('#editarIcono').val(),
"esVisible": $("#chkVisible").is(':checked')
};
$.ajax({
type: 'POST',
......
......@@ -14,6 +14,66 @@
<!--css-->
<link href="../css/general.css" rel="stylesheet" type="text/css"/>
<!--css-->
<style>
.switch{
position: relative;
width: 65px;
height: 27px;
margin: 0px;
appearance: none;
outline: none;
cursor: pointer;
background-color: green;
border-radius: 25px;
transition: all 1s;
}
.switch:before{
content: "";
width: 23px;
height: 23px;
border-radius: 50%;
background-color: #fff;
position: absolute;
transition: all .5s;
transform: translate(2px, 2px);
transition-timing-function: cubic-bezier(0.81, -0.02, 0, 2.13);
transition-delay: .1s;
box-shadow: inset 2px 0px 4px rgba(0,0,0,.5),
-2px 0px 2px rgba(0,0,0,.5);
animation: off 1s forwards;
}
.switch:checked{
background-color: white;
transition: all 1s;
}
.switch:checked:before{
transition: all .5s;
transform: translate(40px, 2px);
transition-timing-function: cubic-bezier(0.81, -0.02, 0, 2.13);
box-shadow: inset -2px 0px 4px rgba(0,0,0,.5),
2px 0px 2px rgba(0,0,0,.5);
transition-delay: .1s;
right: 43px;
animation: on 1s forwards;
}
@keyframes on{
0%, 50%, 100%{
width: 23px;
}
25%{
width: 33px;
}
}
@keyframes off{
0%, 50%, 100%{
width: 23px;
}
25%{
width: 33px;
}
}
</style>
</head>
<body onload="segundaCarga();">
<%@include file="templates/header-body.jsp" %>
......
......@@ -126,6 +126,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
int iCategoria = 0;
JSONObject obj2 = new JSONObject();
JSONObject objModulo = (JSONObject) listaModulo.get(j);
boolean esVisible = objModulo.getBoolean("esVisible");
String nombreModulo = objModulo.getString("nombreModulo");
int codigoModulo = objModulo.getInt("codigoModulo");
int configuracionModulo = objModulo.getInt("configuracionModulo");
......@@ -145,6 +146,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
obj2.put("configuracion", configuracionModulo);
obj2.put("padre", padreModulo);
obj2.put("orden", ordenModulo);
obj2.put("esVisible", esVisible);
lista.put(obj2);
JSONArray listaCategoria = srv.listarCategoriaCompleto(codigoModulo, proyecto_detalle, proyecto, tipo);
for (int k = 0; k < listaCategoria.length(); k++) {
......
......@@ -154,7 +154,7 @@ public class MenuSqlServerDAO implements MenuDAO {
if (tipo == 1) {
extra = " -1 ";
}
query = "select m.cod_modulo, m.cod_titulo, m.nom, m.ico, m.url, m.tip, m.est, 0, 0, count(*) as cant "
query = "select m.esvisible, m.cod_modulo, m.cod_titulo, m.nom, m.ico, m.url, m.tip, m.est, 0, 0, count(*) as cant "
+ "from modulo_configuracion mc "
+ "left join proyecto_detalle as pd "
+ "on mc.cod_proyecto_detalle = pd.cod_proyecto_detalle "
......@@ -170,7 +170,7 @@ public class MenuSqlServerDAO implements MenuDAO {
+ "where cod_proyecto = " + proyecto + " "
+ ") ";
} else {
query = " select m.cod_modulo, m.cod_titulo, m.nom, m.ico, m.url, m.tip, m.est, mc.cod_modulo_configuracion, mc.ord from modulo as m"
query = " select m.esvisible, m.cod_modulo, m.cod_titulo, m.nom, m.ico, m.url, m.tip, m.est, mc.cod_modulo_configuracion, mc.ord from modulo as m"
+ " inner join modulo_configuracion as mc"
+ " on m.cod_modulo = mc.cod_modulo "
+ " where cod_proyecto_detalle = " + proyecto_detalle + " "
......@@ -182,15 +182,16 @@ public class MenuSqlServerDAO implements MenuDAO {
rs = pst.executeQuery();
while (rs.next()) {
JSONObject obj = new JSONObject();
obj.put("codigoModulo", rs.getInt(1));
obj.put("codigoTitulo", rs.getInt(2));
obj.put("nombreModulo", rs.getString(3));
obj.put("iconoModulo", rs.getString(4));
obj.put("urlModulo", rs.getString(5));
obj.put("tipoModulo", rs.getInt(6));
obj.put("estadoModulo", rs.getInt(7));
obj.put("configuracionModulo", rs.getString(8));
obj.put("ordenModulo", rs.getString(9));
obj.put("esVisible", rs.getBoolean(1));
obj.put("codigoModulo", rs.getInt(2));
obj.put("codigoTitulo", rs.getInt(3));
obj.put("nombreModulo", rs.getString(4));
obj.put("iconoModulo", rs.getString(5));
obj.put("urlModulo", rs.getString(6));
obj.put("tipoModulo", rs.getInt(7));
obj.put("estadoModulo", rs.getInt(8));
obj.put("configuracionModulo", rs.getString(9));
obj.put("ordenModulo", rs.getString(10));
lista.put(obj);
}
} catch (Exception e) {
......@@ -387,11 +388,19 @@ public class MenuSqlServerDAO implements MenuDAO {
try {
con = SqlServerDAOFactory.getConnectionSQL(base);
int visible = 0;
//validando el visible
if(datos.getBoolean("esVisible")){
visible = 1;
}
String sql
= " update modulo "
+ " set nom = RTRIM(UPPER(?)), "
+ " ico = RTRIM(?), "
+ " tip = ?, "
+ " esvisible = ?, "
+ " url = RTRIM(?) "
+ " where cod_modulo = ? ";
......@@ -399,8 +408,9 @@ public class MenuSqlServerDAO implements MenuDAO {
pstEditarModulo.setString(1, datos.getString("nombre"));
pstEditarModulo.setString(2, datos.getString("icono"));
pstEditarModulo.setInt(3, datos.getInt("tipo"));
pstEditarModulo.setString(4, datos.getString("url"));
pstEditarModulo.setInt(5, datos.getInt("codigo"));
pstEditarModulo.setInt(4, visible);
pstEditarModulo.setString(5, datos.getString("url"));
pstEditarModulo.setInt(6, datos.getInt("codigo"));
rsModulo = pstEditarModulo.executeUpdate();
if (rsModulo == 1) {
......
......@@ -23,8 +23,8 @@ public class SqlServerDAOFactory extends DAOFactory {
public static Connection getConnectionSQL(String base) {
Connection conexion = null;
if (base.equalsIgnoreCase("security")) {
String user = "###############";
String pwd = "################";
String user = "###########";
String pwd = "##########";
String url = "jdbc:sqlserver://172.16.0.6:1433;databaseName=security";
// String url = "jdbc:sqlserver://172.16.2.40:1433;databaseName=Security";
......
......@@ -230,11 +230,13 @@
}
function crearFormEdicion(data) {
console.log(data);
var tipo = data["tipo"];
var codigo = data["codigo"];
var jerarquia = data["jerarquia"];
var nombre = data["nombre"];
var url = data["url"];
var visible = data["esVisible"];
var txturl;
if (tipo === 1 || jerarquia === 4) {
txturl = url.slice(0, -4);
......@@ -284,6 +286,12 @@
<span class="input-group-addon"><div class="" style="color:#848484">.jsp</div></span>
</div>
</div>
<div class='frm col-md-6' id="formEsVisible">
<label style="font-size: small">
Es visible:
</label>
<input id="chkVisible" name="chkEsVisible" class="icp-opts form-control switch" type="checkbox"/>
</div>
<div class='col-md-12 hide' id="formHide">
&nbsp;
</div>
......@@ -345,6 +353,13 @@
if (jerarquia === 2 || jerarquia === 3) {
validarDependenciaEditar(data);
}
if(visible){
$("#chkVisible").prop("checked", true);
}else{
$("#chkVisible").removeAttr("checked");
}
validarFormulario(jerarquia);
submitKey('formEditarMenu', '.buttonOk');
validCaracForm();
......@@ -420,13 +435,15 @@
} else {
txturl = url;
}
var json = {
"codigo": data.codigo,
"jerarquia": data.jerarquia,
"tipo": tipoMenu,
"url": txturl,
"nombre": $('#editarNombre').val(),
"icono": $('#editarIcono').val()
"icono": $('#editarIcono').val(),
"esVisible": $("#chkVisible").is(':checked')
};
$.ajax({
type: 'POST',
......
......@@ -14,6 +14,66 @@
<!--css-->
<link href="../css/general.css" rel="stylesheet" type="text/css"/>
<!--css-->
<style>
.switch{
position: relative;
width: 65px;
height: 27px;
margin: 0px;
appearance: none;
outline: none;
cursor: pointer;
background-color: green;
border-radius: 25px;
transition: all 1s;
}
.switch:before{
content: "";
width: 23px;
height: 23px;
border-radius: 50%;
background-color: #fff;
position: absolute;
transition: all .5s;
transform: translate(2px, 2px);
transition-timing-function: cubic-bezier(0.81, -0.02, 0, 2.13);
transition-delay: .1s;
box-shadow: inset 2px 0px 4px rgba(0,0,0,.5),
-2px 0px 2px rgba(0,0,0,.5);
animation: off 1s forwards;
}
.switch:checked{
background-color: white;
transition: all 1s;
}
.switch:checked:before{
transition: all .5s;
transform: translate(40px, 2px);
transition-timing-function: cubic-bezier(0.81, -0.02, 0, 2.13);
box-shadow: inset -2px 0px 4px rgba(0,0,0,.5),
2px 0px 2px rgba(0,0,0,.5);
transition-delay: .1s;
right: 43px;
animation: on 1s forwards;
}
@keyframes on{
0%, 50%, 100%{
width: 23px;
}
25%{
width: 33px;
}
}
@keyframes off{
0%, 50%, 100%{
width: 23px;
}
25%{
width: 33px;
}
}
</style>
</head>
<body onload="segundaCarga();">
<%@include file="templates/header-body.jsp" %>
......
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