Arreglo de errores

master
Araozu 2018-07-15 17:16:35 -05:00
parent a44f2d9fad
commit 4a164fd1a1
29 changed files with 222 additions and 46 deletions

View File

@ -72,12 +72,13 @@ public class AccessControllerAdd extends HttpServlet {
String idRole = request.getParameter("rolesl");
String idResource = request.getParameter("resourcesl");
boolean status = Boolean.parseBoolean(request.getParameter("status"));
if(idRole == null || idRole.equals("")|| idResource == null || idResource.equals("")){
System.out.print("nombre vacio");
}
else {
Access a = new Access(idRole, idResource,true);
Access a = new Access(idRole, idResource,status);
//persist the entity
pm.makePersistent(a);
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Acceso creado con éxito.\"}");

View File

@ -51,6 +51,7 @@ public class AccessControllerEdit extends HttpServlet {
String idRole = request.getParameter("rolesl");
String idResource = request.getParameter("resourcesl");
boolean status = Boolean.parseBoolean(request.getParameter("status"));
if(idRole == null || idRole.equals("")|| idResource == null || idResource.equals("")){
@ -67,6 +68,8 @@ public class AccessControllerEdit extends HttpServlet {
a.setResourceKey(idResource);
}
a.setStatus(status);
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Acceso editado con éxito.\"}");
response.sendRedirect("/e/access");

View File

@ -37,7 +37,7 @@
  Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
@ -155,6 +155,30 @@
<% } %>
<br />
Estado del Recurso:<br />
<br />
<div class="switch" id="siwtchContainer">
<label>
Falso
<input id="sivth" type="checkbox" name="status" value="false">
<span class="lever"></span>
Verdadero
</label>
</div>
<br />
<script>
document.getElementById("siwtchContainer").addEventListener("mouseup",changeSwitch);
var elSwitch = document.getElementById("sivth");
function changeSwitch() {
if (elSwitch.value === "false") {
elSwitch.value = "true";
} else {
elSwitch.value = "false";
}
}
</script>
<button id="sendButton" class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
<i class="material-icons right">send</i>

View File

@ -36,7 +36,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
@ -140,6 +140,38 @@
<% } %>
</select><br />
Estado:<br />
<br />
<div class="switch" id="siwtchContainer">
<label>
Falso
<input id="sivth" type="checkbox" name="status" value="false">
<span class="lever"></span>
Verdadero
</label>
</div>
<br />
<script>
document.getElementById("siwtchContainer").addEventListener("mouseup",changeSwitch);
var elSwitch = document.getElementById("sivth");
if ("<%=a.getStatus()%>" === "true"){
elSwitch.checked = "true";
elSwitch.value = "true";
}
function changeSwitch() {
if (elSwitch.value === "false") {
elSwitch.value = "true";
} else {
elSwitch.value = "false";
}
console.log("anumaaa -> " + elSwitch.value);
}
</script>
<button id="sendButton" class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Editar
<i class="material-icons right">send</i>
</button>

View File

@ -37,7 +37,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -30,7 +30,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -36,7 +36,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -40,7 +40,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -38,7 +38,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -39,7 +39,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -39,7 +39,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -35,8 +35,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<%= user.getName()%>
<span id="nombreUsuario"%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
<i class="material-icons">arrow_drop_down</i>

View File

@ -41,7 +41,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -35,7 +35,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
@ -106,17 +106,34 @@
URI del Recurso:<br />
<input name="url" placeholder="URI del Recurso" required><br />
Estado del Recurso:<br />
<select name="status" class="browser-default" required>
<option value="" disabled selected>Choose a status</option>
<option value="true">true</option>
<option value="false">false</option>
</select>
<br />
<div class="switch" id="siwtchContainer">
<label>
Falso
<input id="sivth" type="checkbox" name="status" value="false">
<span class="lever"></span>
Verdadero
</label>
</div>
<br />
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
<i class="material-icons right">send</i>
</button>
<script>
document.getElementById("siwtchContainer").addEventListener("mouseup",changeSwitch);
var elSwitch = document.getElementById("sivth");
function changeSwitch() {
if (elSwitch.value === "false") {
elSwitch.value = "true";
} else {
elSwitch.value = "false";
}
}
</script>
</form>
<hr />
<br />

View File

@ -41,7 +41,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -39,7 +39,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
@ -115,12 +115,36 @@
<input name="url" value="<%=resource.getUrl()%>" placeholder="URI" required><br/>
<br/>
Estado:<br />
<select name="status" class="browser-default" required>
<option value="" disabled selected>Choose a status</option>
<option value="true">true</option>
<option value="false">false</option>
</select>
<br />
<div class="switch" id="siwtchContainer">
<label>
Falso
<input id="sivth" type="checkbox" name="status" value="false">
<span class="lever"></span>
Verdadero
</label>
</div>
<br />
<script>
document.getElementById("siwtchContainer").addEventListener("mouseup",changeSwitch);
var elSwitch = document.getElementById("sivth");
if ("<%=resource.getStatus()%>" === "true"){
elSwitch.checked = "true";
elSwitch.value = "true";
}
function changeSwitch() {
if (elSwitch.value === "false") {
elSwitch.value = "true";
} else {
elSwitch.value = "false";
}
console.log("anumaaa -> " + elSwitch.value);
}
</script>
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Editar
<i class="material-icons right">send</i>

View File

@ -34,7 +34,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
@ -106,11 +106,6 @@
<input name="roleName" placeholder="Nombre del Rol" required><br />
Estado del Rol:<br />
<br />
<!--<select name="roleStatus" class="browser-default" required>
<option value="" disabled selected>Choose a status</option>
<option value="true">true</option>
<option value="false">false</option>
</select>-->
<div class="switch" id="siwtchContainer">
<label>
Falso

View File

@ -56,7 +56,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -38,7 +38,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -35,7 +35,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -40,7 +40,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -38,7 +38,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -37,7 +37,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -39,7 +39,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -16,7 +16,7 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title><%=action%> a Role - Hotel Services</title>
<title><%=action%> un Usuario - Hotel Services</title>
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
@ -30,8 +30,7 @@
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<script src="../../js/GlobalJs.js" async defer></script>
<script src="../../js/GlobalJs.js" defer></script>
</head>
<body>
@ -41,9 +40,10 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
<i class="material-icons">arrow_drop_down</i>
@ -52,7 +52,7 @@
<ul style="color: black">
<li style="padding: 0 5px;">
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Log Out</a>
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
</li>
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
@ -177,5 +177,6 @@
}
</script>
</body>
</html>

View File

@ -51,7 +51,7 @@
&nbsp;&nbsp;Empleados
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= user.getName()%>
</span>
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -75,3 +75,9 @@ body{
font-weight: bold;
src: url("../fonts/ProductSansBold.ttf");
}
#nombreUsuario{
max-width: 115px;
max-height: 64px;
overflow: hidden;
}

View File

@ -175,7 +175,7 @@
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
<span style="min-width: 80px;">
<span id="nombreUsuario" style="min-width: 80px;">
<%= usuario.getName()%>
</span>
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">

View File

@ -35,3 +35,77 @@ function postRedirect(url, postData){
postForm.submit();
}
var maxLenght = 16;
function isVowel(letter) {
var vowels = ["a","e","i","o","u"];
for (a in vowels){
var vowel = vowels[a];
if (letter.toLowerCase() === vowel)
return true;
}
return false;
}
(function formatName() {
var name;
try{
name = document.getElementById("nombreUsuario").innerText;
} catch (e) {}
if(name !== undefined){
name = name.trim();
console.log("El nombre -> " + name);
var words = name.split("");
var result = "";
var isLonger = true;
if (maxLenght > words.length){
maxLenght = words.length;
isLonger = false;
}
var isFirstWord = true;
for (var i=0; i<maxLenght; i++){
if (words[i] === " "){
result += " ";
isFirstWord = true;
} else if (isFirstWord) {
result += words[i].toUpperCase();
isFirstWord = false;
} else {
result += words[i].toLowerCase();
}
}
if (isLonger){
words = result.split("");
for (var c = words.length; c > maxLenght-3 ; c--){
if (isVowel(words[c-1])){
words[c] = "";
} else if (words[c-1] === " "){
words[c] = "";
words[c-1] = "";
break;
} else {
words[c] = ".";
}
}
result = words.join("");
}
document.getElementById("nombreUsuario").innerHTML = result;
}
})();