Compare commits
No commits in common. "0dffef12b4827aa61c538699f6691c7f435d0bc1" and "2994b38f08bb4cf1f5dd6a1f9629be2122405185" have entirely different histories.
0dffef12b4
...
2994b38f08
@ -1,10 +1,10 @@
|
|||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="API AppEngine 1">
|
<library name="API AppEngine 1">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$USER_HOME$/Desktop/Universidad/Java EE/API AppEngine 1.9" />
|
<root url="file://$USER_HOME$/Desktop/Java EE/API AppEngine 1.9" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
<jarDirectory url="file://$USER_HOME$/Desktop/Universidad/Java EE/API AppEngine 1.9" recursive="false" />
|
<jarDirectory url="file://$USER_HOME$/Desktop/Java EE/API AppEngine 1.9" recursive="false" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
@ -1,9 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="JavaScriptSettings">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<option name="languageLevel" value="ES5" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
1252
.idea/workspace.xml
1252
.idea/workspace.xml
File diff suppressed because it is too large
Load Diff
@ -38,7 +38,8 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
|
<orderEntry type="library" name="com.google.appengine.eclipse.core.GAE_CONTAINER/appengine-java-sdk-1.9.54" level="application" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="library" name="API AppEngine 1" level="project" />
|
<orderEntry type="library" name="API AppEngine 1" level="project" />
|
||||||
<orderEntry type="library" name="platform" level="application" />
|
<orderEntry type="library" name="platform" level="application" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package controller;
|
package controller;
|
||||||
|
|
||||||
import javax.jdo.JDOHelper;
|
import javax.jdo.JDOHelper;
|
||||||
import javax.jdo.PersistenceManagerFactory;
|
import javax.jdo.PersistenceManagerFactory;
|
||||||
|
|
||||||
/* clase "pmf.PMF" que va a tener la variable encargada de controlar las peticiones
|
/* clase "pmf.PMF" que va a tener la variable encargada de controlar las peticiones
|
||||||
* de registros y búsqueda de la información almacenada. */
|
* de registros y búsqueda de la información almacenada. */
|
||||||
|
129
src/controller/access/AccessControllerAdd.java
Normal file
129
src/controller/access/AccessControllerAdd.java
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
package controller.access;
|
||||||
|
|
||||||
|
import controller.PMF;
|
||||||
|
import controller.resources.ResourcesControllerView;
|
||||||
|
import controller.roles.RolesControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Access;
|
||||||
|
import model.Resource;
|
||||||
|
import model.Role;
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class AccessControllerAdd extends HttpServlet {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
|
||||||
|
String query = "select from " + Role.class.getName();
|
||||||
|
String query2 = "select from " + Resource.class.getName();
|
||||||
|
|
||||||
|
List<Role> roles = RolesControllerView.getAllRoles();
|
||||||
|
List<Resource> resources = ResourcesControllerView.getAllResources();
|
||||||
|
|
||||||
|
request.setAttribute("roles", roles);
|
||||||
|
request.setAttribute("resources", resources);
|
||||||
|
|
||||||
|
boolean redirect = true;
|
||||||
|
|
||||||
|
//String queryp = "select " + Role.class.getName();
|
||||||
|
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/add.jsp");
|
||||||
|
|
||||||
|
if (request.getParameter("info") == null){
|
||||||
|
|
||||||
|
try{
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
|
||||||
|
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
||||||
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
|
request.setAttribute("User",user);
|
||||||
|
request.setAttribute("ResourceList",ResourcesControllerView.getAllResources());
|
||||||
|
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
redirect = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no la encuentra, redirige a la pagina inicial.
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(request.getParameter("info").equals("agregar")){
|
||||||
|
|
||||||
|
String idRole = request.getParameter("rolesl");
|
||||||
|
String idResource = request.getParameter("resourcesl");
|
||||||
|
|
||||||
|
if(idRole == null || idRole.equals("")|| idResource == null || idResource.equals("")){
|
||||||
|
System.out.print("nombre vacio");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Access a = new Access(idRole, idResource,true);
|
||||||
|
//persist the entity
|
||||||
|
pm.makePersistent(a);
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Access created successfully.\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (request.getParameter("info").equals("check")){
|
||||||
|
response.getWriter().print(accessExist(request.getParameter("rolesl"),request.getParameter("resourcesl")));
|
||||||
|
redirect = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
|
||||||
|
try{
|
||||||
|
if (redirect){
|
||||||
|
request.setAttribute("serverResponse","");
|
||||||
|
response.sendRedirect("/access");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
|
catch (IllegalStateException e){
|
||||||
|
System.err.println("IllegalStateException: There was a double redirect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doGet(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private boolean accessExist(String role, String resource){
|
||||||
|
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
List<Access> accessList = (List<Access>) pm.newQuery("select from " + Access.class.getName()).execute();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String roleKey = RolesControllerView.getRole(role).getKey();
|
||||||
|
String resourceKey = ResourcesControllerView.getResource(resource).getKey();
|
||||||
|
for (Access access: accessList){
|
||||||
|
if (access.getRoleKey().equals(roleKey)){
|
||||||
|
if (access.getResourceKey().equals(resourceKey)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (IllegalArgumentException e){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
38
src/controller/access/AccessControllerDelete.java
Normal file
38
src/controller/access/AccessControllerDelete.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package controller.access;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import model.*;
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
|
||||||
|
import controller.PMF;
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class AccessControllerDelete extends HttpServlet {
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
// create the persistence manager instance
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
// create the new account
|
||||||
|
try{
|
||||||
|
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("accessId")));
|
||||||
|
Access r = pm.getObjectById(Access.class, k);
|
||||||
|
|
||||||
|
pm.deletePersistent(r);
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Access deleted successfully.\"}");
|
||||||
|
response.sendRedirect("/access");
|
||||||
|
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
|
response.sendRedirect("/access");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doGet(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
93
src/controller/access/AccessControllerEdit.java
Normal file
93
src/controller/access/AccessControllerEdit.java
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
package controller.access;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.PMF;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Access;
|
||||||
|
import model.Resource;
|
||||||
|
import model.Role;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class AccessControllerEdit extends HttpServlet {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
// create the persistence manager instance
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
try{
|
||||||
|
|
||||||
|
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
||||||
|
|
||||||
|
Access a = pm.getObjectById(Access.class, k);
|
||||||
|
|
||||||
|
request.setAttribute("access", a);
|
||||||
|
|
||||||
|
String query = "select from " + Role.class.getName();
|
||||||
|
String query2 = "select from " + Resource.class.getName();
|
||||||
|
|
||||||
|
List<Role> roles = (List<Role>)pm.newQuery(query).execute();
|
||||||
|
List<Resource> resources = (List<Resource>)pm.newQuery(query2).execute();
|
||||||
|
|
||||||
|
request.setAttribute("roles", roles);
|
||||||
|
request.setAttribute("resources", resources);
|
||||||
|
|
||||||
|
try{
|
||||||
|
if(request.getParameter("info").equals("editar")){
|
||||||
|
|
||||||
|
String idRole = request.getParameter("rolesl");
|
||||||
|
String idResource = request.getParameter("resourcesl");
|
||||||
|
|
||||||
|
if(idRole == null || idRole.equals("")|| idResource == null || idResource.equals("")){
|
||||||
|
|
||||||
|
System.out.print("nombre vacio");
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
if(!a.getRoleKey().equals(idRole)){
|
||||||
|
a.setRoleKey(idRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!a.getResourceKey().equals(idResource)){
|
||||||
|
a.setResourceKey(idResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Access updated successfully.\"}");
|
||||||
|
|
||||||
|
response.sendRedirect("/access");
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if(request.getParameter("info").equals("redirect")){
|
||||||
|
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/edit.jsp");
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (java.lang.NullPointerException np){
|
||||||
|
System.err.println("AccessControllerEdit Exception -> NPE:");
|
||||||
|
np.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
|
response.sendRedirect("/index.html");
|
||||||
|
} catch (NumberFormatException e){
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doGet(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
src/controller/access/AccessControllerIndex.java
Normal file
67
src/controller/access/AccessControllerIndex.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package controller.access;
|
||||||
|
|
||||||
|
import controller.PMF;
|
||||||
|
import controller.resources.ResourcesControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Access;
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class AccessControllerIndex extends HttpServlet {
|
||||||
|
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
|
||||||
|
|
||||||
|
// create the persistence manager instance
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
|
||||||
|
//Se usa para revisar si hay una sesion activa
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
|
||||||
|
//Intenta hallar una sesion activa
|
||||||
|
try{
|
||||||
|
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
||||||
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
|
request.setAttribute("User",user);
|
||||||
|
|
||||||
|
// query for the entities by name
|
||||||
|
String query = "select from " + Access.class.getName();
|
||||||
|
List<Access> accesses = (List<Access>)pm.newQuery(query).execute();
|
||||||
|
|
||||||
|
// pass the list to the jsp
|
||||||
|
request.setAttribute("accesses", accesses);
|
||||||
|
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
|
|
||||||
|
// forward the request to the jsp
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/index.jsp");
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no la encuentra, redirige a la pagina inicial para que se cree la sesion.
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
||||||
|
} finally {
|
||||||
|
pm.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doGet(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
package controller.usersManagement.access;
|
package controller.access;
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.PMF;
|
import controller.PMF;
|
||||||
import controller.usersManagement.resources.ResourcesControllerView;
|
import controller.resources.ResourcesControllerView;
|
||||||
import controller.usersManagement.roles.RolesControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
import controller.users.UsersControllerView;
|
||||||
import model.Access;
|
import model.Access;
|
||||||
import model.Resource;
|
import model.Resource;
|
||||||
import model.Role;
|
import model.Role;
|
||||||
@ -24,15 +24,11 @@ import java.util.List;
|
|||||||
public class AccessControllerView extends HttpServlet {
|
public class AccessControllerView extends HttpServlet {
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
// create the persistence manager instance
|
// create the persistence manager instance
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())) {
|
|
||||||
|
|
||||||
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
||||||
Access a = pm.getObjectById(Access.class, k);
|
Access a = pm.getObjectById(Access.class, k);
|
||||||
|
|
||||||
@ -50,24 +46,15 @@ public class AccessControllerView extends HttpServlet {
|
|||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/view.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/view.jsp");
|
||||||
dispatcher.forward(request, response);
|
dispatcher.forward(request, response);
|
||||||
|
|
||||||
} else {
|
}catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para ver un Acceso.\"}");
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
|
||||||
System.err.println("JDOObjectNotFound -> AccessControllerView");
|
System.err.println("JDOObjectNotFound -> AccessControllerView");
|
||||||
nf.printStackTrace();
|
nf.printStackTrace();
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"darkorange\",\"response\":\"Ocurrio un error.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"darkorange\",\"response\":\"Error trying to view the Access.\"}");
|
||||||
response.sendRedirect("/e/access");
|
response.sendRedirect("/access");
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
System.err.println("NPE -> Trying to access a servlet without logging in.");
|
System.err.println("NPE -> Trying to access a servlet without logging in.");
|
||||||
e.printStackTrace();
|
response.sendRedirect("/users");
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,18 +92,19 @@ public class AccessControllerView extends HttpServlet {
|
|||||||
* */
|
* */
|
||||||
public static boolean checkPermission(String userID, String uri){
|
public static boolean checkPermission(String userID, String uri){
|
||||||
|
|
||||||
User user = UsersControllerView.getUser(userID);
|
User user = (User) UsersControllerView.getUser(userID);
|
||||||
|
String userRoleName = user.getRoleName();
|
||||||
String userRoleKey = user.getRoleKey();
|
String userRoleKey = user.getRoleKey();
|
||||||
if (userRoleKey == null)
|
if (userRoleKey == null)
|
||||||
userRoleKey = "";
|
userRoleKey = "";
|
||||||
|
|
||||||
if (user.getRoleName().equals("admin")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Access access: getAllAccess()){
|
for (Access access: getAllAccess()){
|
||||||
if (access.getRoleKey().equals(userRoleKey) && access.getStatus()){
|
if (userRoleName.equals("admin")){
|
||||||
if (access.getResourceName().equals(uri) && ResourcesControllerView.getResource(access.getResourceKey()).getStatus()){
|
return true;
|
||||||
|
} else if (access.getRoleKey().equals(userRoleKey)){
|
||||||
|
System.out.println("Encontrado USuario con Rol coincidente");
|
||||||
|
if (access.getResourceName().equals(uri)){
|
||||||
|
System.out.println("El USuario tiene acceso a esta URI");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,78 +0,0 @@
|
|||||||
package controller.clientControllers;
|
|
||||||
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class transactionsHistory extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
|
|
||||||
ArrayList<String> lista = crearArrayList(user.getTransactionList());
|
|
||||||
|
|
||||||
if (lista != null){
|
|
||||||
request.setAttribute("transactionList",lista);
|
|
||||||
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/ClientViews/transactionsHistory.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"orange\",\"response\":\"Aún no tienes ninguna transacción..\"}");
|
|
||||||
response.sendRedirect("/");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
System.err.println("Error catched. " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<String> crearArrayList(String datos){
|
|
||||||
ArrayList<String> lista = new ArrayList<>();
|
|
||||||
|
|
||||||
if (datos.length() > 2){
|
|
||||||
do
|
|
||||||
{
|
|
||||||
lista.add(datos.substring(0,datos.indexOf(",")));
|
|
||||||
datos = datos.substring(datos.indexOf(",")+1);
|
|
||||||
}
|
|
||||||
while (datos.length() > 2);
|
|
||||||
|
|
||||||
return lista;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package controller.financesManagement;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class IncomeReport extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Finances/index.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
System.err.println("UserControllerIndex: Error catched. " + e.getMessage());
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to access /reports.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
package controller.financesManagement.transactions;
|
|
||||||
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.resourcesManagement.services.ServicesControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Service;
|
|
||||||
import model.Transaction;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class TransactionsControllerAdd extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
//Para evitar errores, si no hay ninguna accion, se establece a vacio.
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
if (action.equals("userAddTransaction")){
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String userId = request.getSession().getAttribute("userID").toString();
|
|
||||||
Service service = ServicesControllerView.getService(request.getParameter("serviceKey").toString());
|
|
||||||
|
|
||||||
Transaction transaction = new Transaction(userId,service.getKey(),service.getPrice() + "");
|
|
||||||
User user = pm.getObjectById(User.class, request.getSession().getAttribute("userID").toString());
|
|
||||||
|
|
||||||
pm.makePersistent(transaction);
|
|
||||||
|
|
||||||
user.addTransaction(transaction.getKey());
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"¡Listo! Tu transacción se completó.\"}");
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
System.err.println("Error NPE ->");
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package controller.financesManagement.transactions;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import model.Transaction;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TransactionsControllerView extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
static List<Transaction> getAllTransactions (){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
List<Transaction> transactions = (List<Transaction>) pm.newQuery("select from " + Transaction.class.getName()).execute();
|
|
||||||
pm.close();
|
|
||||||
return transactions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Transaction getTransaction(String key){
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
Key k = KeyFactory.stringToKey(key);
|
|
||||||
Transaction service = pm.getObjectById(Transaction.class,k);
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
return service;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
package controller;
|
|
||||||
|
|
||||||
import controller.resourcesManagement.services.ServicesControllerView;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class index extends HttpServlet {
|
|
||||||
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/index.jsp");
|
|
||||||
|
|
||||||
User loggedUser;
|
|
||||||
|
|
||||||
try {
|
|
||||||
loggedUser = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
loggedUser = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loggedUser != null){
|
|
||||||
|
|
||||||
request.setAttribute("hasAccess",AccessControllerView.checkPermission(sesion.getAttribute("userID").toString(),"/e/"));
|
|
||||||
request.setAttribute("User",loggedUser);
|
|
||||||
request.setAttribute("isUserLogged",true);
|
|
||||||
request.setAttribute("servicesList",ServicesControllerView.getAllServices());
|
|
||||||
request.setAttribute("serverResponse",request.getSession().getAttribute("serverResponse"));
|
|
||||||
request.getSession().setAttribute("serverResponse","!");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.setAttribute("isUserLogged",false);
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
88
src/controller/resources/ResourcesControllerAdd.java
Normal file
88
src/controller/resources/ResourcesControllerAdd.java
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
package controller.resources;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Resource;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ResourcesControllerAdd extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
//Accion a realizar
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
switch (action){
|
||||||
|
//Crea
|
||||||
|
case "create":
|
||||||
|
|
||||||
|
String url = request.getParameter("url");
|
||||||
|
Boolean status = Boolean.parseBoolean(request.getParameter("status"));
|
||||||
|
|
||||||
|
createRole(url,status,pm);
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Resource created successfully.\"}");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "redirect":
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/add.jsp");
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "update":
|
||||||
|
|
||||||
|
Key a = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
|
|
||||||
|
Resource resourc = pm.getObjectById(Resource.class, a);
|
||||||
|
|
||||||
|
resourc.setUrl(request.getParameter("url"));
|
||||||
|
resourc.setStatus(Boolean.parseBoolean(request.getParameter("status")));
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Resource updated successfully.\"}");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
try{
|
||||||
|
response.sendRedirect("/resources");
|
||||||
|
}
|
||||||
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
|
catch (IllegalStateException e){
|
||||||
|
System.err.println("IllegalStateException: There was a double redirect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createRole(String url, boolean status, PersistenceManager pm){
|
||||||
|
Resource role = new Resource(url,status);
|
||||||
|
|
||||||
|
try{
|
||||||
|
pm.makePersistent(role);
|
||||||
|
return role.getKey();
|
||||||
|
} finally {
|
||||||
|
System.out.println("Role creado");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
src/controller/resources/ResourcesControllerDelete.java
Normal file
45
src/controller/resources/ResourcesControllerDelete.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package controller.resources;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import model.Resource;
|
||||||
|
import model.Role;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ResourcesControllerDelete extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Key key = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
|
try{
|
||||||
|
pm.deletePersistent(pm.getObjectById(Resource.class, key));
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Resource deleted successfully.\"}");
|
||||||
|
} catch (JDOObjectNotFoundException e){
|
||||||
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
System.err.println("Exception captured -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
response.sendRedirect("/resources");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
}
|
47
src/controller/resources/ResourcesControllerIndex.java
Normal file
47
src/controller/resources/ResourcesControllerIndex.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package controller.resources;
|
||||||
|
|
||||||
|
import controller.roles.RolesControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ResourcesControllerIndex extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
//Se usa para revisar si hay una sesion activa
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
|
||||||
|
//Intenta hallar una sesion activa
|
||||||
|
try{
|
||||||
|
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
||||||
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
|
request.setAttribute("User",user);
|
||||||
|
request.setAttribute("ResourceList",ResourcesControllerView.getAllResources());
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/index.jsp");
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no la encuentra, redirige a la pagina inicial.
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
}
|
97
src/controller/resources/ResourcesControllerView.java
Normal file
97
src/controller/resources/ResourcesControllerView.java
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package controller.resources;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Resource;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static controller.roles.RolesControllerView.getRole;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ResourcesControllerView extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
//Para evitar errores, si no hay ninguna accion, se establece a vacio.
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
String key = request.getParameter("key");
|
||||||
|
|
||||||
|
//Redirige al formulario para editar un Resource (resource/view)
|
||||||
|
if (action.equals("editRedirect") && key != null){
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/view.jsp");
|
||||||
|
request.setAttribute("Resource",getResource(key));
|
||||||
|
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
|
||||||
|
//Ya que se quiere editar, el atributo permitirEdicion es verdadero. Este atributo se comprueba en el JSP.
|
||||||
|
request.setAttribute("editAllowed",true);
|
||||||
|
request.setAttribute("action","Edit");
|
||||||
|
try{
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
} catch (javax.servlet.ServletException e){
|
||||||
|
System.err.println("Exception captured -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Redirige al formulario para ver un usuario (user/view)
|
||||||
|
else if (action.equals("viewRedirect") && key != null){
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/view.jsp");
|
||||||
|
request.setAttribute("Resource",getResource(key));
|
||||||
|
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
|
||||||
|
//Ya que no quiere editar, el atributo permitirEdicion es falso. Este atributo se comprueba en el JSP.
|
||||||
|
request.setAttribute("editAllowed",false);
|
||||||
|
request.setAttribute("action","View");
|
||||||
|
try{
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
} catch (javax.servlet.ServletException e){
|
||||||
|
System.err.println("Exception captured -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no se encontró acción, regresa al inicio
|
||||||
|
else {
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metodo Estatico getAllResources
|
||||||
|
*
|
||||||
|
* Devuelve un list con todos los Recursos que existen desde cualquier parte del codigo.
|
||||||
|
*
|
||||||
|
* @return Un List<Resource> con todos los Recursos
|
||||||
|
* */
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static List<Resource> getAllResources(){
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
List<Resource> resources = (List<Resource>) pm.newQuery("select from " + Resource.class.getName()).execute();
|
||||||
|
pm.close();
|
||||||
|
return resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Resource getResource(String key){
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
Key k = KeyFactory.stringToKey(key);
|
||||||
|
Resource resource = pm.getObjectById(Resource.class, k);
|
||||||
|
pm.close();
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,101 +0,0 @@
|
|||||||
package controller.resourcesManagement.employees;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Employee;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class EmployeesControllerAdd extends HttpServlet {
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
if (action.equals("create")){
|
|
||||||
|
|
||||||
String name = request.getParameter("Name");
|
|
||||||
String phone = request.getParameter("Phone");
|
|
||||||
String email = request.getParameter("Email");
|
|
||||||
Long dni = Long.parseLong(request.getParameter("Dni"));
|
|
||||||
String userCreatorKey = request.getParameter("userId");
|
|
||||||
|
|
||||||
Employee employee = new Employee (name, phone, email,dni,true,userCreatorKey);
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Employee created successfully.\"}");
|
|
||||||
|
|
||||||
pm.makePersistent(employee);
|
|
||||||
|
|
||||||
|
|
||||||
} else if (action.equals("update")){
|
|
||||||
|
|
||||||
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
|
||||||
|
|
||||||
Employee employee = pm.getObjectById(Employee.class,k);
|
|
||||||
|
|
||||||
employee.setName(request.getParameter("Name"));
|
|
||||||
employee.setDni(Long.parseLong(request.getParameter("Dni")));
|
|
||||||
employee.setEmail(request.getParameter("Email"));
|
|
||||||
employee.setPhone(request.getParameter("Phone"));
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Empleado creado con éxito.\"}");
|
|
||||||
|
|
||||||
} else if (action.equals("redirect")){
|
|
||||||
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Employees/add.jsp");
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
try{
|
|
||||||
response.sendRedirect("/e/employees");
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para crear un Empleado.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
|
|
||||||
doGet(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package controller.resourcesManagement.employees;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import model.Employee;
|
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class EmployeesControllerDelete extends HttpServlet {
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String employeeKey = request.getParameter("employeeKey");
|
|
||||||
|
|
||||||
try{
|
|
||||||
Key k = KeyFactory.stringToKey(employeeKey);
|
|
||||||
Employee employee = pm.getObjectById(Employee.class, k);
|
|
||||||
|
|
||||||
pm.deletePersistent(employee);
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Empleado eliminado con éxito.\"}");
|
|
||||||
} catch (JDOObjectNotFoundException e){
|
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
response.sendRedirect("/e/employees");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Empleado.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException{
|
|
||||||
doGet(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
package controller.resourcesManagement.employees;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static controller.resourcesManagement.employees.EmployeesControllerView.getAllEmployees;
|
|
||||||
|
|
||||||
public class EmployeesControllerIndex extends HttpServlet {
|
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("EmployeesList",getAllEmployees());
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Employees/index.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
System.err.println("UserControllerIndex: Error catched. " + e.getMessage());
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/employees.\"}");
|
|
||||||
response.sendRedirect("/e/");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
|
||||||
doPost(req, resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package controller.resourcesManagement.employees;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Employee;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class EmployeesControllerView extends HttpServlet {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
if (action.equals("editRedirect")) {
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Employees/view.jsp");
|
|
||||||
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
request.setAttribute("Employee",getEmployee(request.getParameter("employeeKey")));
|
|
||||||
|
|
||||||
request.setAttribute("editAllowed",true);
|
|
||||||
request.setAttribute("action","Edit");
|
|
||||||
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (action.equals("viewRedirect")) {
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Employees/view.jsp");
|
|
||||||
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
request.setAttribute("Employee",getEmployee(request.getParameter("employeeKey")));
|
|
||||||
|
|
||||||
request.setAttribute("editAllowed",false);
|
|
||||||
request.setAttribute("action","View");
|
|
||||||
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no se encontró acción, regresa al inicio
|
|
||||||
else {
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para editar/ver un Empleado.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
|
||||||
doGet(req, resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
static List<Employee> getAllEmployees(){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
List<Employee> employees = (List<Employee>) pm.newQuery("select from " + Employee.class.getName()).execute();
|
|
||||||
pm.close();
|
|
||||||
return employees;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Employee getEmployee(String key){
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
Key k = KeyFactory.stringToKey(key);
|
|
||||||
Employee employee = pm.getObjectById(Employee.class,k);
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
return employee;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
package controller.resourcesManagement.materials;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Material;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class MaterialsControllerAdd extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
if (action.equals("create")){
|
|
||||||
|
|
||||||
String name = request.getParameter("Name");
|
|
||||||
int price = Integer.parseInt(request.getParameter("Price"));
|
|
||||||
int amount = Integer.parseInt(request.getParameter("Amount"));
|
|
||||||
String unity = request.getParameter("Unity");
|
|
||||||
|
|
||||||
Material material = new Material(name, price, amount, unity);
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Material creado con éxito.\"}");
|
|
||||||
|
|
||||||
pm.makePersistent(material);
|
|
||||||
|
|
||||||
|
|
||||||
} else if (action.equals("update")){
|
|
||||||
|
|
||||||
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
|
||||||
|
|
||||||
Material material = pm.getObjectById(Material.class,k);
|
|
||||||
|
|
||||||
material.setName(request.getParameter("Name"));
|
|
||||||
material.setPrice(Integer.parseInt(request.getParameter("Price")));
|
|
||||||
material.setAmount(Integer.parseInt(request.getParameter("Amount")));
|
|
||||||
material.setUnity(request.getParameter("Unity"));
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Material actualizado con éxito.\"}");
|
|
||||||
|
|
||||||
} else if (action.equals("redirect")){
|
|
||||||
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Materials/add.jsp");
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
try{
|
|
||||||
response.sendRedirect("/e/materials");
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para crear un Material.\"}");
|
|
||||||
response.sendRedirect("/e/materials");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package controller.resourcesManagement.materials;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import model.Material;
|
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class MaterialsControllerDelete extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String materialKey = request.getParameter("materialKey");
|
|
||||||
|
|
||||||
try{
|
|
||||||
Key k = KeyFactory.stringToKey(materialKey);
|
|
||||||
Material material = pm.getObjectById(Material.class, k);
|
|
||||||
|
|
||||||
pm.deletePersistent(material);
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Material eliminado con éxito.\"}");
|
|
||||||
} catch (JDOObjectNotFoundException e){
|
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
response.sendRedirect("/e/materials");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Material.\"}");
|
|
||||||
response.sendRedirect("/e/materials");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package controller.resourcesManagement.materials;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static controller.resourcesManagement.materials.MaterialsControllerView.getAllMaterials;
|
|
||||||
|
|
||||||
public class MaterialsControllerIndex extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("materialList",getAllMaterials());
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Materials/index.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
System.err.println("UserControllerIndex: Error catched. " + e.getMessage());
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/materials.\"}");
|
|
||||||
response.sendRedirect("/e/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package controller.resourcesManagement.materials;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Material;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MaterialsControllerView extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
if (action.equals("editRedirect")) {
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Materials/view.jsp");
|
|
||||||
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
request.setAttribute("Material",getMaterial(request.getParameter("materialKey")));
|
|
||||||
|
|
||||||
request.setAttribute("editAllowed",true);
|
|
||||||
request.setAttribute("action","Editar");
|
|
||||||
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (action.equals("viewRedirect")) {
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Materials/view.jsp");
|
|
||||||
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
request.setAttribute("Material",getMaterial(request.getParameter("materialKey")));
|
|
||||||
|
|
||||||
request.setAttribute("editAllowed",false);
|
|
||||||
request.setAttribute("action","Ver");
|
|
||||||
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no se encontró acción, regresa al inicio
|
|
||||||
else {
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para editar/ver un Material.\"}");
|
|
||||||
response.sendRedirect("/e/materials");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
static List<Material> getAllMaterials(){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
List<Material> employees = (List<Material>) pm.newQuery("select from " + Material.class.getName()).execute();
|
|
||||||
pm.close();
|
|
||||||
return employees;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Material getMaterial(String key){
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
Key k = KeyFactory.stringToKey(key);
|
|
||||||
Material material = pm.getObjectById(Material.class,k);
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
102
src/controller/roles/RolesControllerAdd.java
Normal file
102
src/controller/roles/RolesControllerAdd.java
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
package controller.roles;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Role;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RolesControllerAdd
|
||||||
|
*
|
||||||
|
* Permite lo siguiente:
|
||||||
|
*
|
||||||
|
* Crear un Rol -> con el parametro action = create
|
||||||
|
* Redireccionar al form para crear un Rol -> parametro action = redirect
|
||||||
|
* Actualizar un Rol -> parametro action = update
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class RolesControllerAdd extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
//Accion a realizar
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
switch (action){
|
||||||
|
//Crea
|
||||||
|
case "create":
|
||||||
|
|
||||||
|
String name = request.getParameter("roleName");
|
||||||
|
Boolean status = Boolean.parseBoolean(request.getParameter("roleStatus"));
|
||||||
|
|
||||||
|
createRole(name,status,pm);
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Role created successfully.\"}");
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "redirect":
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/add.jsp");
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "update":
|
||||||
|
|
||||||
|
Key a = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
|
|
||||||
|
Role role1 = pm.getObjectById(Role.class, a);
|
||||||
|
|
||||||
|
role1.setName(request.getParameter("roleName"));
|
||||||
|
role1.setStatus(Boolean.parseBoolean(request.getParameter("roleStatus")));
|
||||||
|
//role1.setImgUrl(userImg);
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Role updated successfully.\"}");
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
try{
|
||||||
|
response.sendRedirect("/roles");
|
||||||
|
}
|
||||||
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
|
catch (IllegalStateException e){
|
||||||
|
System.err.println("IllegalStateException: There was a double redirect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createRole(String name, boolean status, PersistenceManager pm){
|
||||||
|
Role role = new Role(name,status);
|
||||||
|
|
||||||
|
try{
|
||||||
|
pm.makePersistent(role);
|
||||||
|
return role.getKey();
|
||||||
|
} finally {
|
||||||
|
System.out.println("Role creado");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
42
src/controller/roles/RolesControllerDelete.java
Normal file
42
src/controller/roles/RolesControllerDelete.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package controller.roles;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import model.Role;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class RolesControllerDelete extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
|
try{
|
||||||
|
pm.deletePersistent(pm.getObjectById(Role.class, k));
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Role deleted successfully.\"}");
|
||||||
|
} catch (JDOObjectNotFoundException e){
|
||||||
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
System.err.println("Exception captured -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
response.sendRedirect("/roles");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package controller.financesManagement.transactions;
|
package controller.roles;
|
||||||
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
import controller.users.UsersControllerView;
|
||||||
import model.User;
|
import model.User;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
@ -11,11 +12,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static controller.financesManagement.transactions.TransactionsControllerView.getAllTransactions;
|
@SuppressWarnings("serial")
|
||||||
|
public class RolesControllerIndex extends HttpServlet {
|
||||||
public class TransactionsControllerIndex extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
//Se usa para revisar si hay una sesion activa
|
||||||
HttpSession sesion= request.getSession();
|
HttpSession sesion= request.getSession();
|
||||||
@ -26,17 +25,17 @@ public class TransactionsControllerIndex extends HttpServlet {
|
|||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
request.setAttribute("User",user);
|
||||||
request.setAttribute("transactionsList",getAllTransactions());
|
request.setAttribute("RoleList",RolesControllerView.getAllRoles());
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
sesion.setAttribute("serverResponse","!");
|
sesion.setAttribute("serverResponse","!");
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Transactions/index.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/index.jsp");
|
||||||
dispatcher.forward(request,response);
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
}
|
}
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
//Si no la encuentra, redirige a la pagina inicial.
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
System.err.println("UserControllerIndex: Error catched. " + e.getMessage());
|
e.printStackTrace();
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
119
src/controller/roles/RolesControllerView.java
Normal file
119
src/controller/roles/RolesControllerView.java
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
package controller.roles;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Role;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RolesControllerView
|
||||||
|
*
|
||||||
|
* Permite ver los Roles
|
||||||
|
*
|
||||||
|
* Metodos importantes:
|
||||||
|
*
|
||||||
|
* public static getAllRoles()
|
||||||
|
* Devuelve un List<Role> con todos los roles que existen.
|
||||||
|
*
|
||||||
|
* public static getRoleKey(String key)
|
||||||
|
* Devuelve un Rol dada una key.
|
||||||
|
* La key se obtiene usando el metodo getKey() de un objeto Role
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class RolesControllerView extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
//Para evitar errores, si no hay ninguna accion, se establece a vacio.
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
String key = request.getParameter("key");
|
||||||
|
|
||||||
|
//Redirige al formulario para editar un Role (role/view)
|
||||||
|
if (action.equals("editRedirect") && key != null){
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/view.jsp");
|
||||||
|
request.setAttribute("Role",getRole(key));
|
||||||
|
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
|
||||||
|
//Ya que se quiere editar, el atributo permitirEdicion es verdadero. Este atributo se comprueba en el JSP.
|
||||||
|
request.setAttribute("editAllowed",true);
|
||||||
|
request.setAttribute("action","Edit");
|
||||||
|
try{
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
} catch (javax.servlet.ServletException e){
|
||||||
|
System.err.println("Exception captured -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Redirige al formulario para ver un usuario (user/view)
|
||||||
|
else if (action.equals("viewRedirect") && key != null){
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/view.jsp");
|
||||||
|
request.setAttribute("Role",getRole(key));
|
||||||
|
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
|
||||||
|
//Ya que no quiere editar, el atributo permitirEdicion es falso. Este atributo se comprueba en el JSP.
|
||||||
|
request.setAttribute("editAllowed",false);
|
||||||
|
request.setAttribute("action","View");
|
||||||
|
try{
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
} catch (javax.servlet.ServletException e){
|
||||||
|
System.err.println("Exception captured -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no se encontró acción, regresa al inicio
|
||||||
|
else {
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metodo Estatico getAllRoles
|
||||||
|
*
|
||||||
|
* Devuelve un list con todos los Roles que existen desde cualquier parte del codigo.
|
||||||
|
*
|
||||||
|
* @return Un List<Role> con todos los Roles
|
||||||
|
* */
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static List<Role> getAllRoles(){
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
List<Role> users = (List<Role>) pm.newQuery("select from " + Role.class.getName()).execute();
|
||||||
|
pm.close();
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Role getRole(String key){
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
Key k = KeyFactory.stringToKey(key);
|
||||||
|
Role role = pm.getObjectById(Role.class, k);
|
||||||
|
pm.close();
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static List<Role> searchRole(String name){
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
List<Role> users = (List<Role>) pm.newQuery("select from " + Role.class.getName() + " where name == '" + name + "'").execute();
|
||||||
|
pm.close();
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package controller.resourcesManagement.services;
|
package controller.services;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
import javax.jdo.PersistenceManager;
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
@ -14,14 +15,15 @@ import javax.servlet.http.HttpSession;
|
|||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.PMF;
|
import controller.PMF;
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
import controller.access.AccessControllerView;
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Access;
|
||||||
import model.Service;
|
import model.Service;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ServicesControllerAdd extends HttpServlet {
|
public class ServicesControllerAdd extends HttpServlet {
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
@ -44,9 +46,9 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
Service service = new Service (name, price, description,userCreatorKey);
|
Service service = new Service (name, price, description,userCreatorKey);
|
||||||
|
|
||||||
pm.makePersistent(service);
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service created successfully.\"}");
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Servicio creado con éxito.\"}");
|
pm.makePersistent(service);
|
||||||
|
|
||||||
|
|
||||||
} else if (action.equals("update")){
|
} else if (action.equals("update")){
|
||||||
@ -61,7 +63,7 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
pm.close();
|
pm.close();
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Servicio editado con éxito.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service updated successfully.\"}");
|
||||||
|
|
||||||
} else if (action.equals("redirect")){
|
} else if (action.equals("redirect")){
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
pm.close();
|
pm.close();
|
||||||
try{
|
try{
|
||||||
response.sendRedirect("/e/services");
|
response.sendRedirect("/services");
|
||||||
}
|
}
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
catch (IllegalStateException e){
|
catch (IllegalStateException e){
|
||||||
@ -83,13 +85,13 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para crear un Servicio.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to create/update a Service.\"}");
|
||||||
response.sendRedirect("/e/services");
|
response.sendRedirect("/users");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
response.sendRedirect("/");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package controller.resourcesManagement.services;
|
package controller.services;
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.PMF;
|
import controller.PMF;
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
import controller.access.AccessControllerView;
|
||||||
import model.Service;
|
import model.Service;
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
@ -12,11 +12,11 @@ import javax.servlet.http.HttpServlet;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ServicesControllerDelete extends HttpServlet {
|
public class ServicesControllerDelete extends HttpServlet {
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
@ -32,23 +32,23 @@ public class ServicesControllerDelete extends HttpServlet {
|
|||||||
|
|
||||||
pm.deletePersistent(service);
|
pm.deletePersistent(service);
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Servicio eliminado con éxito.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service deleted successfully.\"}");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
pm.close();
|
pm.close();
|
||||||
|
|
||||||
response.sendRedirect("/e/services");
|
response.sendRedirect("/services");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Servicio.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to delete a Service.\"}");
|
||||||
response.sendRedirect("/e/services");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
response.sendRedirect("/");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package controller.resourcesManagement.services;
|
package controller.services;
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
import controller.access.AccessControllerView;
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
import controller.users.UsersControllerView;
|
||||||
import model.User;
|
import model.User;
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
@ -11,12 +11,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static controller.resourcesManagement.services.ServicesControllerView.getAllServices;
|
import static controller.services.ServicesControllerView.getAllServices;
|
||||||
|
|
||||||
public class ServicesControllerIndex extends HttpServlet {
|
public class ServicesControllerIndex extends HttpServlet {
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
@ -45,13 +44,12 @@ public class ServicesControllerIndex extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/services.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to access /services.\"}");
|
||||||
response.sendRedirect("/e/");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
e.printStackTrace();
|
response.sendRedirect("/users");
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
|||||||
package controller.resourcesManagement.services;
|
package controller.services;
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.PMF;
|
import controller.PMF;
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
import controller.access.AccessControllerView;
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
import controller.users.UsersControllerView;
|
||||||
import model.Service;
|
import model.Service;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
import javax.jdo.PersistenceManager;
|
import javax.jdo.PersistenceManager;
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
@ -20,7 +21,6 @@ public class ServicesControllerView extends HttpServlet {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
@ -73,12 +73,12 @@ public class ServicesControllerView extends HttpServlet {
|
|||||||
pm.close();
|
pm.close();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para ver/editar un Servicio.\"}");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to view/edit a Service.\"}");
|
||||||
response.sendRedirect("/e/services");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
response.sendRedirect("/");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -88,14 +88,14 @@ public class ServicesControllerView extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static List<Service> getAllServices(){
|
static List<Service> getAllServices(){
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
List<Service> services = (List<Service>) pm.newQuery("select from " + Service.class.getName()).execute();
|
List<Service> services = (List<Service>) pm.newQuery("select from " + Service.class.getName()).execute();
|
||||||
pm.close();
|
pm.close();
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Service getService(String key){
|
private static Service getService(String key){
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
Key k = KeyFactory.stringToKey(key);
|
Key k = KeyFactory.stringToKey(key);
|
184
src/controller/users/UsersControllerAdd.java
Normal file
184
src/controller/users/UsersControllerAdd.java
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
package controller.users;
|
||||||
|
|
||||||
|
import controller.roles.RolesControllerAdd;
|
||||||
|
import controller.roles.RolesControllerView;
|
||||||
|
import model.Role;
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class UsersControllerAdd extends HttpServlet {
|
||||||
|
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
//Accion a realizar
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
//Respuesta del servidor
|
||||||
|
String serverResponse = "!";
|
||||||
|
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
//Email del usuario
|
||||||
|
String userEmail = request.getParameter("userEmail");
|
||||||
|
|
||||||
|
//Solo se usa al actualizar un usuario.
|
||||||
|
String prevUserID = request.getParameter("userID");
|
||||||
|
|
||||||
|
//El ID del usuario. Este id se obtiene del email -> en richard@gmail.com el ID es richard
|
||||||
|
String userID;
|
||||||
|
try {
|
||||||
|
userID = userEmail.substring(0,userEmail.indexOf("@"));
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
userID = prevUserID;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Parametros necesarios.
|
||||||
|
String userName = request.getParameter("userName");
|
||||||
|
String userImg = request.getParameter("userImg");
|
||||||
|
String userRole = request.getParameter("userRole");
|
||||||
|
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
//Si se quiere iniciar sesion y/o registrar un usuario desde el inicio de sesion de Google
|
||||||
|
case "logIn":
|
||||||
|
|
||||||
|
//Busca si ya existe una sesion iniciada
|
||||||
|
HttpSession misesion = request.getSession();
|
||||||
|
|
||||||
|
List<Role> roleList = RolesControllerView.searchRole(userRole);
|
||||||
|
|
||||||
|
if (roleList.size() > 0){
|
||||||
|
userRole = roleList.get(0).getKey();
|
||||||
|
} else {
|
||||||
|
userRole = RolesControllerAdd.createRole(userRole,true,pm);
|
||||||
|
}
|
||||||
|
|
||||||
|
createUser(userID, userEmail, userName, userImg, userRole, pm);
|
||||||
|
|
||||||
|
//Si no existe la sesion, la crea usando el ID del usuario
|
||||||
|
if (!sesionExist(misesion)) {
|
||||||
|
|
||||||
|
misesion.invalidate();
|
||||||
|
|
||||||
|
misesion = request.getSession(true);
|
||||||
|
misesion.setAttribute("userID", userID);
|
||||||
|
|
||||||
|
//La sesion perdurara sin actividad durante 1h.
|
||||||
|
misesion.setMaxInactiveInterval(3600);
|
||||||
|
}
|
||||||
|
|
||||||
|
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"You are logged in.\"}";
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Si lo que se quiere es redirigir al Form para crear usuario
|
||||||
|
case "redirect":
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/add.jsp");
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
||||||
|
request.setAttribute("Roles",RolesControllerView.getAllRoles());
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Si lo que se quiere es Crear (proviene del formulario)
|
||||||
|
case "create":
|
||||||
|
createUser(userID, userEmail, userName, userImg, userRole, pm);
|
||||||
|
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"User created successfully.\"}";
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Si lo que se quiere es actualizar un Usuario
|
||||||
|
case "update":
|
||||||
|
|
||||||
|
User user = pm.getObjectById(User.class, prevUserID);
|
||||||
|
|
||||||
|
user.setName(userName);
|
||||||
|
user.setEmail(userEmail);
|
||||||
|
user.setImgUrl(userImg);
|
||||||
|
user.setRoleKey(userRole);
|
||||||
|
|
||||||
|
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"Service updated successfully.\"}";
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
try{
|
||||||
|
request.getSession().setAttribute("serverResponse",serverResponse);
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
|
catch (IllegalStateException e){
|
||||||
|
System.err.println("IllegalStateException: There was a double redirect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
//Redirige a doPost
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Revisa si un usuario existe: id -> ID del usuario (ejm. en richard@gmail.com el ID es richard)
|
||||||
|
private boolean userExists(String userID, PersistenceManager pm){
|
||||||
|
try{
|
||||||
|
//Intenta buscar en el DataStore un usuario con el ID respectivo.
|
||||||
|
User usr = pm.getObjectById(User.class, userID);
|
||||||
|
|
||||||
|
//Si lo encuentra devuelve true (el usuario si existe)
|
||||||
|
return true;
|
||||||
|
} catch (JDOObjectNotFoundException exc){
|
||||||
|
//Si no lo encuentra, se lanza una Excepción, se captura, y se devuelve false (el usuario no existe)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Comprueba si existe una sesion: sesion -> Objeto HttpSesion que contiene la sesion actual
|
||||||
|
private boolean sesionExist(HttpSession sesion){
|
||||||
|
try{
|
||||||
|
//Intenta buscar el atributo userID dentro de la sesion
|
||||||
|
String a = sesion.getAttribute("userID").toString();
|
||||||
|
System.out.println("Sesion existe -> " + a);
|
||||||
|
//Si lo encuentra, la sesion si existe
|
||||||
|
return true;
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
//Si no, la sesion no existe
|
||||||
|
System.out.println("Sesion no existe");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createUser(String userID, String userEmail, String userName, String userImg, String userRole, PersistenceManager pm){
|
||||||
|
|
||||||
|
//Revisa si el usuario con su ID ya tiene un objeto User Persistente almacenado.
|
||||||
|
//Si no existe, crea el objeto de tipo User con los datos que se obtienen del request, y lo hace Persistente.
|
||||||
|
if (!userExists(userID, pm)){
|
||||||
|
|
||||||
|
//El new Role es provisional, hasta que termine la implementacion del CRUD de Role.
|
||||||
|
User user = new User(userID, userName, userImg, userEmail, userRole);
|
||||||
|
|
||||||
|
try{
|
||||||
|
pm.makePersistent(user);
|
||||||
|
} finally {
|
||||||
|
System.out.println("Usuario creado con exito -> " + user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
38
src/controller/users/UsersControllerDelete.java
Normal file
38
src/controller/users/UsersControllerDelete.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package controller.users;
|
||||||
|
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class UsersControllerDelete extends HttpServlet {
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
String userID = request.getParameter("userID");
|
||||||
|
|
||||||
|
try{
|
||||||
|
pm.deletePersistent(pm.getObjectById(User.class, userID));
|
||||||
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service deleted sucessfully.\"}");
|
||||||
|
} catch (JDOObjectNotFoundException e){
|
||||||
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
47
src/controller/users/UsersControllerIndex.java
Normal file
47
src/controller/users/UsersControllerIndex.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package controller.users;
|
||||||
|
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class UsersControllerIndex extends HttpServlet {
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
|
//Se usa para revisar si hay una sesion activa
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
|
||||||
|
//Intenta hallar una sesion activa
|
||||||
|
try{
|
||||||
|
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
||||||
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
|
request.setAttribute("User",user);
|
||||||
|
request.setAttribute("UsersList",UsersControllerView.getAllUsers());
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/index.jsp");
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no la encuentra, redirige a la pagina inicial.
|
||||||
|
catch (Exception e){
|
||||||
|
System.err.println("UserControllerIndex: Error catched. " + e.getMessage());
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
doPost(request, response);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package controller.usersManagement.users;
|
package controller.users;
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
import controller.usersManagement.roles.RolesControllerView;
|
|
||||||
import model.User;
|
import model.User;
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
@ -18,9 +17,6 @@ import java.util.List;
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class UsersControllerView extends HttpServlet {
|
public class UsersControllerView extends HttpServlet {
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
@ -28,16 +24,14 @@ public class UsersControllerView extends HttpServlet {
|
|||||||
if (action == null)
|
if (action == null)
|
||||||
action = "";
|
action = "";
|
||||||
|
|
||||||
if(action.equals("closeSession")){
|
|
||||||
closeSession(request,response);
|
|
||||||
}
|
|
||||||
else if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())) {
|
|
||||||
|
|
||||||
|
|
||||||
String userID = request.getParameter("userID");
|
String userID = request.getParameter("userID");
|
||||||
|
|
||||||
|
//Si se quiere cerrar la sesion actual
|
||||||
|
if (action.equals("closeSession")){
|
||||||
|
closeSession(request,response);
|
||||||
|
}
|
||||||
//Redirige al formulario para editar un usario (user/view)
|
//Redirige al formulario para editar un usario (user/view)
|
||||||
if (action.equals("editRedirect") && userID != null){
|
else if (action.equals("editRedirect") && userID != null){
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/view.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/view.jsp");
|
||||||
request.setAttribute("User",getUser(userID));
|
request.setAttribute("User",getUser(userID));
|
||||||
request.setAttribute("UserLogged",getUser(request.getSession().getAttribute("userID").toString()));
|
request.setAttribute("UserLogged",getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
@ -75,24 +69,10 @@ public class UsersControllerView extends HttpServlet {
|
|||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para ver/editar un usuario.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
doPost(request, response);
|
doPost(request, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,6 +144,4 @@ public class UsersControllerView extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,149 +0,0 @@
|
|||||||
package controller.usersManagement.access;
|
|
||||||
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.resources.ResourcesControllerView;
|
|
||||||
import controller.usersManagement.roles.RolesControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Access;
|
|
||||||
import model.Resource;
|
|
||||||
import model.Role;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class AccessControllerAdd extends HttpServlet {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if(AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String query = "select from " + Role.class.getName();
|
|
||||||
String query2 = "select from " + Resource.class.getName();
|
|
||||||
|
|
||||||
List<Role> roles = RolesControllerView.getAllRoles();
|
|
||||||
List<Resource> resources = ResourcesControllerView.getAllResources();
|
|
||||||
|
|
||||||
request.setAttribute("roles", roles);
|
|
||||||
request.setAttribute("resources", resources);
|
|
||||||
|
|
||||||
boolean redirect = true;
|
|
||||||
|
|
||||||
//String queryp = "select " + Role.class.getName();
|
|
||||||
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/add.jsp");
|
|
||||||
|
|
||||||
if (request.getParameter("info") == null){
|
|
||||||
|
|
||||||
try{
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("ResourceList",ResourcesControllerView.getAllResources());
|
|
||||||
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
redirect = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if(request.getParameter("info").equals("agregar")){
|
|
||||||
|
|
||||||
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,status);
|
|
||||||
//persist the entity
|
|
||||||
pm.makePersistent(a);
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Acceso creado con éxito.\"}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (request.getParameter("info").equals("check")){
|
|
||||||
response.getWriter().print(accessExist(request.getParameter("rolesl"),request.getParameter("resourcesl")));
|
|
||||||
redirect = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
try{
|
|
||||||
if (redirect){
|
|
||||||
request.setAttribute("serverResponse","");
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para crear un Acceso.\"}");
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doGet(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private boolean accessExist(String role, String resource){
|
|
||||||
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
List<Access> accessList = (List<Access>) pm.newQuery("select from " + Access.class.getName()).execute();
|
|
||||||
|
|
||||||
try {
|
|
||||||
String roleKey = RolesControllerView.getRole(role).getKey();
|
|
||||||
String resourceKey = ResourcesControllerView.getResource(resource).getKey();
|
|
||||||
for (Access access: accessList){
|
|
||||||
if (access.getRoleKey().equals(roleKey)){
|
|
||||||
if (access.getResourceKey().equals(resourceKey)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} catch (IllegalArgumentException e){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package controller.usersManagement.access;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.*;
|
|
||||||
import javax.servlet.*;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import model.*;
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
|
|
||||||
import controller.PMF;
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class AccessControllerDelete extends HttpServlet {
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
// create the persistence manager instance
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
// create the new account
|
|
||||||
try{
|
|
||||||
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("accessId")));
|
|
||||||
Access r = pm.getObjectById(Access.class, k);
|
|
||||||
|
|
||||||
pm.deletePersistent(r);
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Acceso eliminado con éxito.\"}");
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Acceso.\"}");
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doGet(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
package controller.usersManagement.access;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Access;
|
|
||||||
import model.Resource;
|
|
||||||
import model.Role;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class AccessControllerEdit extends HttpServlet {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
// create the persistence manager instance
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
try{
|
|
||||||
|
|
||||||
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
|
||||||
|
|
||||||
Access a = pm.getObjectById(Access.class, k);
|
|
||||||
|
|
||||||
request.setAttribute("access", a);
|
|
||||||
|
|
||||||
String query = "select from " + Role.class.getName();
|
|
||||||
String query2 = "select from " + Resource.class.getName();
|
|
||||||
|
|
||||||
List<Role> roles = (List<Role>)pm.newQuery(query).execute();
|
|
||||||
List<Resource> resources = (List<Resource>)pm.newQuery(query2).execute();
|
|
||||||
|
|
||||||
request.setAttribute("roles", roles);
|
|
||||||
request.setAttribute("resources", resources);
|
|
||||||
|
|
||||||
try{
|
|
||||||
if(request.getParameter("info").equals("editar")){
|
|
||||||
|
|
||||||
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{
|
|
||||||
|
|
||||||
if(!a.getRoleKey().equals(idRole)){
|
|
||||||
a.setRoleKey(idRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!a.getResourceKey().equals(idResource)){
|
|
||||||
a.setResourceKey(idResource);
|
|
||||||
}
|
|
||||||
|
|
||||||
a.setStatus(status);
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Acceso editado con éxito.\"}");
|
|
||||||
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if(request.getParameter("info").equals("redirect")){
|
|
||||||
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/edit.jsp");
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (java.lang.NullPointerException np){
|
|
||||||
System.err.println("AccessControllerEdit Exception -> NPE:");
|
|
||||||
np.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
|
||||||
response.sendRedirect("/");
|
|
||||||
} catch (NumberFormatException e){
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para editar un Acceso.\"}");
|
|
||||||
response.sendRedirect("/e/access");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doGet(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
package controller.usersManagement.access;
|
|
||||||
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Access;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class AccessControllerIndex extends HttpServlet {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
// create the persistence manager instance
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
|
|
||||||
// query for the entities by name
|
|
||||||
String query = "select from " + Access.class.getName();
|
|
||||||
|
|
||||||
List<Access> accesses = (List<Access>)pm.newQuery(query).execute();
|
|
||||||
|
|
||||||
// pass the list to the jsp
|
|
||||||
request.setAttribute("accesses", accesses);
|
|
||||||
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
|
|
||||||
// forward the request to the jsp
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/index.jsp");
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial para que se cree la sesion.
|
|
||||||
catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
|
||||||
} finally {
|
|
||||||
pm.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/access.\"}");
|
|
||||||
response.sendRedirect("/e/");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doGet(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package controller.usersManagement;
|
|
||||||
|
|
||||||
import controller.PMF;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Access;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class index extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
// create the persistence manager instance
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
|
|
||||||
// forward the request to the jsp
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/eIndex.jsp");
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial para que se cree la sesion.
|
|
||||||
catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
|
||||||
} finally {
|
|
||||||
pm.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"Oops. No tienes permiso para acceder.\"}");
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
package controller.usersManagement.resources;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Resource;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class ResourcesControllerAdd extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
//Accion a realizar
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
switch (action){
|
|
||||||
//Crea
|
|
||||||
case "create":
|
|
||||||
|
|
||||||
String url = request.getParameter("url");
|
|
||||||
Boolean status = Boolean.parseBoolean(request.getParameter("status"));
|
|
||||||
|
|
||||||
createRole(url,status,pm);
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Recurso creado con éxito.\"}");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "redirect":
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/add.jsp");
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "update":
|
|
||||||
|
|
||||||
Key a = KeyFactory.stringToKey(request.getParameter("key"));
|
|
||||||
|
|
||||||
Resource resourc = pm.getObjectById(Resource.class, a);
|
|
||||||
|
|
||||||
resourc.setUrl(request.getParameter("url"));
|
|
||||||
resourc.setStatus(Boolean.parseBoolean(request.getParameter("status")));
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Recurso Actualizado con éxito.\"}");
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
try{
|
|
||||||
response.sendRedirect("/e/resources");
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para crear un Recurso.\"}");
|
|
||||||
response.sendRedirect("/e/resources");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createRole(String url, boolean status, PersistenceManager pm){
|
|
||||||
Resource role = new Resource(url,status);
|
|
||||||
|
|
||||||
try{
|
|
||||||
pm.makePersistent(role);
|
|
||||||
return role.getKey();
|
|
||||||
} finally {
|
|
||||||
System.out.println("Role creado");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
package controller.usersManagement.resources;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import model.Resource;
|
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class ResourcesControllerDelete extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Key key = KeyFactory.stringToKey(request.getParameter("key"));
|
|
||||||
try{
|
|
||||||
pm.deletePersistent(pm.getObjectById(Resource.class, key));
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Recurso eliminado con éxito.\"}");
|
|
||||||
} catch (JDOObjectNotFoundException e){
|
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
System.err.println("Exception captured -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
response.sendRedirect("/e/resources");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Recurso.\"}");
|
|
||||||
response.sendRedirect("/e/resources");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
package controller.usersManagement.resources;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class ResourcesControllerIndex extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("ResourceList",ResourcesControllerView.getAllResources());
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/index.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/resources.\"}");
|
|
||||||
response.sendRedirect("/e/");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package controller.usersManagement.resources;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Resource;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class ResourcesControllerView extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
if(AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
//Para evitar errores, si no hay ninguna accion, se establece a vacio.
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
String key = request.getParameter("key");
|
|
||||||
|
|
||||||
//Redirige al formulario para editar un Resource (resource/view)
|
|
||||||
if (action.equals("editRedirect") && key != null){
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/view.jsp");
|
|
||||||
request.setAttribute("Resource",getResource(key));
|
|
||||||
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
|
|
||||||
//Ya que se quiere editar, el atributo permitirEdicion es verdadero. Este atributo se comprueba en el JSP.
|
|
||||||
request.setAttribute("editAllowed",true);
|
|
||||||
request.setAttribute("action","Edit");
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
System.err.println("Exception captured -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Redirige al formulario para ver un usuario (user/view)
|
|
||||||
else if (action.equals("viewRedirect") && key != null){
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/view.jsp");
|
|
||||||
request.setAttribute("Resource",getResource(key));
|
|
||||||
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
|
|
||||||
//Ya que no quiere editar, el atributo permitirEdicion es falso. Este atributo se comprueba en el JSP.
|
|
||||||
request.setAttribute("editAllowed",false);
|
|
||||||
request.setAttribute("action","View");
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
System.err.println("Exception captured -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no se encontró acción, regresa al inicio
|
|
||||||
else {
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para ver Recursos.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
}
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Metodo Estatico getAllResources
|
|
||||||
*
|
|
||||||
* Devuelve un list con todos los Recursos que existen desde cualquier parte del codigo.
|
|
||||||
*
|
|
||||||
* @return Un List<Resource> con todos los Recursos
|
|
||||||
* */
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static List<Resource> getAllResources(){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
List<Resource> resources = (List<Resource>) pm.newQuery("select from " + Resource.class.getName()).execute();
|
|
||||||
pm.close();
|
|
||||||
return resources;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Resource getResource(String key){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
Key k = KeyFactory.stringToKey(key);
|
|
||||||
Resource resource = pm.getObjectById(Resource.class, k);
|
|
||||||
pm.close();
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package controller.usersManagement.roles;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Role;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RolesControllerAdd
|
|
||||||
*
|
|
||||||
* Permite lo siguiente:
|
|
||||||
*
|
|
||||||
* Crear un Rol -> con el parametro action = create
|
|
||||||
* Redireccionar al form para crear un Rol -> parametro action = redirect
|
|
||||||
* Actualizar un Rol -> parametro action = update
|
|
||||||
* */
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class RolesControllerAdd extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
//Accion a realizar
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
switch (action){
|
|
||||||
//Crea
|
|
||||||
case "create":
|
|
||||||
|
|
||||||
String name = request.getParameter("roleName");
|
|
||||||
Boolean status = Boolean.parseBoolean(request.getParameter("roleStatus"));
|
|
||||||
|
|
||||||
createRole(name,status,pm);
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Rol creado con éxito.\"}");
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "redirect":
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/add.jsp");
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "update":
|
|
||||||
|
|
||||||
Key a = KeyFactory.stringToKey(request.getParameter("key"));
|
|
||||||
|
|
||||||
Role role1 = pm.getObjectById(Role.class, a);
|
|
||||||
|
|
||||||
role1.setName(request.getParameter("roleName"));
|
|
||||||
role1.setStatus(Boolean.parseBoolean(request.getParameter("roleStatus")));
|
|
||||||
//role1.setImgUrl(userImg);
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Rol editado con éxito.\"}");
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
try{
|
|
||||||
response.sendRedirect("/e/roles");
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/roles.\"}");
|
|
||||||
response.sendRedirect("/e/roles");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createRole(String name, boolean status, PersistenceManager pm){
|
|
||||||
Role role = new Role(name,status);
|
|
||||||
|
|
||||||
try{
|
|
||||||
pm.makePersistent(role);
|
|
||||||
return role.getKey();
|
|
||||||
} finally {
|
|
||||||
System.out.println("Role creado");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package controller.usersManagement.roles;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import model.Role;
|
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class RolesControllerDelete extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
|
||||||
try{
|
|
||||||
pm.deletePersistent(pm.getObjectById(Role.class, k));
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Rol eliminado con éxito.\"}");
|
|
||||||
} catch (JDOObjectNotFoundException e){
|
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
System.err.println("Exception captured -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
response.sendRedirect("/e/roles");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Rol.\"}");
|
|
||||||
response.sendRedirect("/e/roles");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package controller.usersManagement.roles;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class RolesControllerIndex extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
if(AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
try{
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("RoleList",RolesControllerView.getAllRoles());
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/index.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/roles.\"}");
|
|
||||||
response.sendRedirect("/e/");
|
|
||||||
}
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,115 +0,0 @@
|
|||||||
package controller.usersManagement.roles;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
import model.Role;
|
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class RolesControllerView extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
//Para evitar errores, si no hay ninguna accion, se establece a vacio.
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
String key = request.getParameter("key");
|
|
||||||
|
|
||||||
//Redirige al formulario para editar un Role (role/view)
|
|
||||||
if (action.equals("editRedirect") && key != null){
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/view.jsp");
|
|
||||||
request.setAttribute("Role",getRole(key));
|
|
||||||
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
|
|
||||||
//Ya que se quiere editar, el atributo permitirEdicion es verdadero. Este atributo se comprueba en el JSP.
|
|
||||||
request.setAttribute("editAllowed",true);
|
|
||||||
request.setAttribute("action","Edit");
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
System.err.println("Exception captured -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Redirige al formulario para ver un usuario (user/view)
|
|
||||||
else if (action.equals("viewRedirect") && key != null){
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/view.jsp");
|
|
||||||
request.setAttribute("Role",getRole(key));
|
|
||||||
request.setAttribute("UserLogged",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
|
||||||
|
|
||||||
//Ya que no quiere editar, el atributo permitirEdicion es falso. Este atributo se comprueba en el JSP.
|
|
||||||
request.setAttribute("editAllowed",false);
|
|
||||||
request.setAttribute("action","View");
|
|
||||||
try{
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
} catch (javax.servlet.ServletException e){
|
|
||||||
System.err.println("Exception captured -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si no se encontró acción, regresa al inicio
|
|
||||||
else {
|
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para ver un Rol.\"}");
|
|
||||||
response.sendRedirect("/e/roles");
|
|
||||||
}
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Metodo Estatico getAllRoles
|
|
||||||
*
|
|
||||||
* Devuelve un list con todos los Roles que existen desde cualquier parte del codigo.
|
|
||||||
*
|
|
||||||
* @return Un List<Role> con todos los Roles
|
|
||||||
* */
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static List<Role> getAllRoles(){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
List<Role> users = (List<Role>) pm.newQuery("select from " + Role.class.getName()).execute();
|
|
||||||
pm.close();
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Role getRole(String key){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
Key k = KeyFactory.stringToKey(key);
|
|
||||||
Role role = pm.getObjectById(Role.class, k);
|
|
||||||
pm.close();
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static List<Role> searchRole(String name){
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
List<Role> users = (List<Role>) pm.newQuery("select from " + Role.class.getName() + " where name == '" + name + "'").execute();
|
|
||||||
pm.close();
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,215 +0,0 @@
|
|||||||
package controller.usersManagement.users;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import controller.usersManagement.roles.RolesControllerAdd;
|
|
||||||
import controller.usersManagement.roles.RolesControllerView;
|
|
||||||
import model.Role;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class UsersControllerAdd extends HttpServlet {
|
|
||||||
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if(request.getParameter("action").equals("logIn") ||
|
|
||||||
AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
//Accion a realizar
|
|
||||||
String action = request.getParameter("action");
|
|
||||||
|
|
||||||
//Respuesta del servidor
|
|
||||||
String serverResponse = "!";
|
|
||||||
|
|
||||||
if (action == null)
|
|
||||||
action = "";
|
|
||||||
|
|
||||||
//Email del usuario
|
|
||||||
String userEmail = request.getParameter("userEmail");
|
|
||||||
|
|
||||||
//Solo se usa al actualizar un usuario.
|
|
||||||
String prevUserID = request.getParameter("userID");
|
|
||||||
|
|
||||||
//El ID del usuario. Este id se obtiene del email -> en richard@gmail.com el ID es richard
|
|
||||||
String userID;
|
|
||||||
try {
|
|
||||||
userID = userEmail.substring(0,userEmail.indexOf("@"));
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
userID = prevUserID;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Parametros necesarios.
|
|
||||||
String userName = request.getParameter("userName");
|
|
||||||
String userImg = request.getParameter("userImg");
|
|
||||||
String userRole = request.getParameter("userRole");
|
|
||||||
|
|
||||||
String rutaRedireccion = "/e/users";
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
//Si se quiere iniciar sesion y/o registrar un usuario desde el inicio de sesion de Google
|
|
||||||
case "logIn":
|
|
||||||
|
|
||||||
//Busca si ya existe una sesion iniciada
|
|
||||||
HttpSession misesion = request.getSession();
|
|
||||||
|
|
||||||
List<Role> roleList = RolesControllerView.searchRole(userRole);
|
|
||||||
|
|
||||||
if (roleList.size() > 0){
|
|
||||||
userRole = roleList.get(0).getKey();
|
|
||||||
} else {
|
|
||||||
userRole = RolesControllerAdd.createRole("Cliente",true,pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
createUser(userID, userEmail, userName, userImg, userRole, pm);
|
|
||||||
|
|
||||||
//Si no existe la sesion, la crea usando el ID del usuario
|
|
||||||
if (!sesionExist(misesion)) {
|
|
||||||
|
|
||||||
misesion.invalidate();
|
|
||||||
|
|
||||||
misesion = request.getSession(true);
|
|
||||||
misesion.setAttribute("userID", userID);
|
|
||||||
|
|
||||||
//La sesion perdurara sin actividad durante 1h.
|
|
||||||
misesion.setMaxInactiveInterval(3600);
|
|
||||||
}
|
|
||||||
|
|
||||||
rutaRedireccion = "/";
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
//Si lo que se quiere es redirigir al Form para crear usuario
|
|
||||||
case "redirect":
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/add.jsp");
|
|
||||||
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
|
||||||
request.setAttribute("Roles",RolesControllerView.getAllRoles());
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
break;
|
|
||||||
|
|
||||||
//Si lo que se quiere es Crear (proviene del formulario)
|
|
||||||
case "create":
|
|
||||||
createUser(userID, userEmail, userName, userImg, userRole, pm);
|
|
||||||
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"Usuario creado con éxito.\"}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
//Si lo que se quiere es actualizar un Usuario
|
|
||||||
case "update":
|
|
||||||
|
|
||||||
User user = pm.getObjectById(User.class, prevUserID);
|
|
||||||
|
|
||||||
user.setName(userName);
|
|
||||||
user.setEmail(userEmail);
|
|
||||||
user.setImgUrl(userImg);
|
|
||||||
user.setRoleKey(userRole);
|
|
||||||
|
|
||||||
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"Usuario editado con éxito.\"}";
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
try{
|
|
||||||
request.getSession().setAttribute("serverResponse",serverResponse);
|
|
||||||
response.sendRedirect(rutaRedireccion);
|
|
||||||
}
|
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
|
||||||
catch (IllegalStateException e){
|
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para editar un usuario.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}catch (NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
//Redirige a doPost
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Revisa si un usuario existe: id -> ID del usuario (ejm. en richard@gmail.com el ID es richard)
|
|
||||||
private boolean userExists(String userID, PersistenceManager pm){
|
|
||||||
try{
|
|
||||||
//Intenta buscar en el DataStore un usuario con el ID respectivo.
|
|
||||||
User usr = pm.getObjectById(User.class, userID);
|
|
||||||
|
|
||||||
//Si lo encuentra devuelve true (el usuario si existe)
|
|
||||||
return true;
|
|
||||||
} catch (JDOObjectNotFoundException exc){
|
|
||||||
//Si no lo encuentra, se lanza una Excepción, se captura, y se devuelve false (el usuario no existe)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Comprueba si existe una sesion: sesion -> Objeto HttpSesion que contiene la sesion actual
|
|
||||||
private boolean sesionExist(HttpSession sesion){
|
|
||||||
try{
|
|
||||||
//Intenta buscar el atributo userID dentro de la sesion
|
|
||||||
String a = sesion.getAttribute("userID").toString();
|
|
||||||
System.out.println("Sesion existe -> " + a);
|
|
||||||
//Si lo encuentra, la sesion si existe
|
|
||||||
return true;
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
//Si no, la sesion no existe
|
|
||||||
System.out.println("Sesion no existe");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createUser(String userID, String userEmail, String userName, String userImg, String userRole, PersistenceManager pm){
|
|
||||||
|
|
||||||
//Revisa si el usuario con su ID ya tiene un objeto User Persistente almacenado.
|
|
||||||
//Si no existe, crea el objeto de tipo User con los datos que se obtienen del request, y lo hace Persistente.
|
|
||||||
if (!userExists(userID, pm)){
|
|
||||||
|
|
||||||
//El new Role es provisional, hasta que termine la implementacion del CRUD de Role.
|
|
||||||
User user = new User(userID, userName, userImg, userEmail, userRole);
|
|
||||||
|
|
||||||
try{
|
|
||||||
pm.makePersistent(user);
|
|
||||||
} finally {
|
|
||||||
System.out.println("Usuario creado con exito -> " + user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Si el usuario ya existe, lo obtiene, revisa su imagen de perfil, y la actualiza (si al iniciar sesion con Google no coinciden).
|
|
||||||
else {
|
|
||||||
|
|
||||||
User loggedUser = pm.getObjectById(User.class,userID);
|
|
||||||
|
|
||||||
if (!userImg.equals(loggedUser.getImgUrl()))
|
|
||||||
loggedUser.setImgUrl(userImg);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package controller.usersManagement.users;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.jdo.JDOObjectNotFoundException;
|
|
||||||
import javax.jdo.PersistenceManager;
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class UsersControllerDelete extends HttpServlet {
|
|
||||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
|
||||||
|
|
||||||
String userID = request.getParameter("userID");
|
|
||||||
|
|
||||||
try{
|
|
||||||
pm.deletePersistent(pm.getObjectById(User.class, userID));
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Usuario eliminado con éxito.\"}");
|
|
||||||
} catch (JDOObjectNotFoundException e){
|
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.close();
|
|
||||||
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para eliminar un Usuario.\"}");
|
|
||||||
response.sendRedirect("/e/users");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package controller.usersManagement.users;
|
|
||||||
|
|
||||||
import controller.usersManagement.access.AccessControllerView;
|
|
||||||
import model.User;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class UsersControllerIndex extends HttpServlet {
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
try{
|
|
||||||
//Se usa para revisar si hay una sesion activa
|
|
||||||
HttpSession sesion= request.getSession();
|
|
||||||
|
|
||||||
if (AccessControllerView.checkPermission(sesion.getAttribute("userID").toString(),request.getRequestURI())){
|
|
||||||
|
|
||||||
//Intenta hallar una sesion activa
|
|
||||||
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
|
||||||
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
|
||||||
|
|
||||||
request.setAttribute("User",user);
|
|
||||||
request.setAttribute("UsersList",UsersControllerView.getAllUsers());
|
|
||||||
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
|
||||||
sesion.setAttribute("serverResponse","!");
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/index.jsp");
|
|
||||||
dispatcher.forward(request,response);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"No tienes permiso para acceder a /e/users.\"}");
|
|
||||||
response.sendRedirect("/e/");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
|
||||||
//Si el usuario no tiene permiso tambien redirigie a la pagina inicial
|
|
||||||
} catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
response.sendRedirect("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
||||||
doPost(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
package model;
|
package model;
|
||||||
|
|
||||||
import controller.usersManagement.resources.ResourcesControllerView;
|
import controller.resources.ResourcesControllerView;
|
||||||
import controller.usersManagement.roles.RolesControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
|
|
||||||
import javax.jdo.annotations.IdGeneratorStrategy;
|
import javax.jdo.annotations.IdGeneratorStrategy;
|
||||||
import javax.jdo.annotations.IdentityType;
|
import javax.jdo.annotations.IdentityType;
|
||||||
|
@ -1,102 +0,0 @@
|
|||||||
package model;
|
|
||||||
|
|
||||||
import javax.jdo.annotations.*;
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
|
||||||
|
|
||||||
@PersistenceCapable(identityType=IdentityType.APPLICATION)
|
|
||||||
public class Employee {
|
|
||||||
|
|
||||||
@PrimaryKey
|
|
||||||
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
|
|
||||||
private Key key;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private Long dni;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private boolean status;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String creatorUserId;
|
|
||||||
|
|
||||||
public Employee(String name, String phone, String email, Long dni,boolean status,String creatorUserKey) {
|
|
||||||
this.name = name;
|
|
||||||
this.phone = phone;
|
|
||||||
this.email = email;
|
|
||||||
this.dni = dni;
|
|
||||||
this.status = status;
|
|
||||||
this.creatorUserId = creatorUserKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*Getters and Setters*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
public void setPhone(String phone) {
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDni() {
|
|
||||||
return dni;
|
|
||||||
}
|
|
||||||
public void setDni(Long dni) {
|
|
||||||
this.dni = dni;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setStatus(boolean status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return KeyFactory.keyToString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatorUserId(){
|
|
||||||
return creatorUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatorUserName(){
|
|
||||||
String name;
|
|
||||||
try{
|
|
||||||
name = UsersControllerView.getUser(creatorUserId).getName();
|
|
||||||
} catch (Exception e){
|
|
||||||
name = "<span style=\"color: red; font-weight: bold\">The User doesn't exists.</span>";
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*To String*/
|
|
||||||
public String toString(){
|
|
||||||
return "Name: " + name + "\n Dni: " + dni + "\n Email: " + email + "\n Phone: " + phone + ".\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package model;
|
|
||||||
|
|
||||||
import javax.jdo.annotations.*;
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
@PersistenceCapable(identityType=IdentityType.APPLICATION)
|
|
||||||
public class Material {
|
|
||||||
|
|
||||||
@PrimaryKey
|
|
||||||
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
|
|
||||||
private Key key;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//Precio por unity
|
|
||||||
@Persistent
|
|
||||||
private int price;
|
|
||||||
|
|
||||||
//Tipo de unidad -> Peso, cantidad, medida, volumen, etc.
|
|
||||||
@Persistent
|
|
||||||
private String unity;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private int amount;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String createDate;
|
|
||||||
|
|
||||||
public Material(String name, int price, int quantity, String unity) {
|
|
||||||
this.name = name;
|
|
||||||
this.price = price;
|
|
||||||
this.amount = quantity;
|
|
||||||
this.unity = unity;
|
|
||||||
|
|
||||||
DateFormat df = new SimpleDateFormat("HH:mm:ss dd/MM/yy");
|
|
||||||
this.createDate = df.format(Calendar.getInstance().getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return KeyFactory.keyToString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
public void setPrice(int price) {
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnity() {
|
|
||||||
return unity;
|
|
||||||
}
|
|
||||||
public void setUnity(String unity) {
|
|
||||||
this.unity = unity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAmount() {
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
public void setAmount(int amount) {
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@ package model;
|
|||||||
import javax.jdo.annotations.*;
|
import javax.jdo.annotations.*;
|
||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.usersManagement.users.UsersControllerView;
|
import controller.users.UsersControllerView;
|
||||||
|
|
||||||
@PersistenceCapable(identityType=IdentityType.APPLICATION)
|
@PersistenceCapable(identityType=IdentityType.APPLICATION)
|
||||||
public class Service {
|
public class Service {
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
package model;
|
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Key;
|
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
|
||||||
import controller.resourcesManagement.services.ServicesControllerView;
|
|
||||||
|
|
||||||
import javax.jdo.annotations.*;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
@PersistenceCapable(identityType = IdentityType.APPLICATION)
|
|
||||||
public class Transaction {
|
|
||||||
|
|
||||||
@PrimaryKey
|
|
||||||
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
|
|
||||||
private Key key;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String userID;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String serviceKey;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String servicePrice;
|
|
||||||
|
|
||||||
@Persistent
|
|
||||||
private String createDate;
|
|
||||||
|
|
||||||
public Transaction(String userID, String serviceKey, String servicePrice) {
|
|
||||||
this.userID = userID;
|
|
||||||
this.serviceKey = serviceKey;
|
|
||||||
this.servicePrice = servicePrice;
|
|
||||||
|
|
||||||
DateFormat df = new SimpleDateFormat("HH:mm:ss dd/MM/yy");
|
|
||||||
this.createDate = df.format(Calendar.getInstance().getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return KeyFactory.keyToString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserID() {
|
|
||||||
return userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServiceKey() {
|
|
||||||
return serviceKey;
|
|
||||||
}
|
|
||||||
public String getServiceName(){
|
|
||||||
return ServicesControllerView.getService(serviceKey).getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServicePrice() {
|
|
||||||
return servicePrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +1,11 @@
|
|||||||
package model;
|
package model;
|
||||||
|
|
||||||
import controller.usersManagement.roles.RolesControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
|
|
||||||
import javax.jdo.annotations.IdentityType;
|
import javax.jdo.annotations.IdentityType;
|
||||||
import javax.jdo.annotations.PersistenceCapable;
|
import javax.jdo.annotations.PersistenceCapable;
|
||||||
import javax.jdo.annotations.Persistent;
|
import javax.jdo.annotations.Persistent;
|
||||||
import javax.jdo.annotations.PrimaryKey;
|
import javax.jdo.annotations.PrimaryKey;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@PersistenceCapable(identityType = IdentityType.APPLICATION)
|
@PersistenceCapable(identityType = IdentityType.APPLICATION)
|
||||||
public class User {
|
public class User {
|
||||||
@ -33,10 +32,6 @@ public class User {
|
|||||||
@Persistent
|
@Persistent
|
||||||
private String roleKey;
|
private String roleKey;
|
||||||
|
|
||||||
//Lista de Strings con Keys de las transacciones del usuario -> trans,trans,trans,
|
|
||||||
@Persistent
|
|
||||||
private String transactionList;
|
|
||||||
|
|
||||||
//Constructor
|
//Constructor
|
||||||
public User(String id, String name, String imgUrl, String email ,String role){
|
public User(String id, String name, String imgUrl, String email ,String role){
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -44,9 +39,9 @@ public class User {
|
|||||||
this.imgUrl = imgUrl;
|
this.imgUrl = imgUrl;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.roleKey = role;
|
this.roleKey = role;
|
||||||
transactionList = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Getters y Setters
|
//Getters y Setters
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -90,14 +85,6 @@ public class User {
|
|||||||
this.roleKey = roleKey;
|
this.roleKey = roleKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTransactionList() {
|
|
||||||
return transactionList;
|
|
||||||
}
|
|
||||||
public void addTransaction(String transactionKey){
|
|
||||||
transactionList = transactionKey + "," + transactionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//To String
|
//To String
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -12,32 +12,32 @@
|
|||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
<title>Añadir un Acceso - Hotel Services</title>
|
<title>Add an access - Hotel Services</title>
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../..//css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -59,8 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -70,45 +70,39 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li class="active"><a class="whiteLink" href="../access">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Añadir un Acceso</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Add an Access</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style="float: left; display: inline;">
|
<div style="float: left; display: inline;">
|
||||||
<i class="material-icons large" style=" color: #3f51b5">info_outline</i>
|
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: x-large; clear: right; min-height: 87px;">
|
<div style="font-size: x-large; clear: right; min-height: 87px;">
|
||||||
El "admin" tiene acceso total.
|
The admin Role has full access by default.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
@ -121,7 +115,7 @@
|
|||||||
|
|
||||||
<input type="hidden" name="info" value="agregar"/>
|
<input type="hidden" name="info" value="agregar"/>
|
||||||
|
|
||||||
Rol:
|
Role:
|
||||||
<% if(roles.size() > 0) {%>
|
<% if(roles.size() > 0) {%>
|
||||||
<select id="formRole" name="rolesl" class="browser-default" required oninput="accessExists()">
|
<select id="formRole" name="rolesl" class="browser-default" required oninput="accessExists()">
|
||||||
<option value="!" disabled selected>Choose a Role</option>
|
<option value="!" disabled selected>Choose a Role</option>
|
||||||
@ -132,16 +126,16 @@
|
|||||||
</select>
|
</select>
|
||||||
<% } else {%>
|
<% } else {%>
|
||||||
<br />
|
<br />
|
||||||
<span style="color: darkorange; font-size: x-large">No hay Roles registrados.</span>
|
<span style="color: darkorange; font-size: x-large">No Roles registered.</span>
|
||||||
<script>buttonDisabled = true</script>
|
<script>buttonDisabled = true</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
Recurso:
|
Resource:
|
||||||
|
|
||||||
<% if (resourses.size() > 0) { %>
|
<% if (resourses.size() > 0) { %>
|
||||||
<select id="formResource" name="resourcesl" class="browser-default" required oninput="accessExists()">
|
<select id="formResource" name="resourcesl" class="browser-default" required oninput="accessExists()">
|
||||||
<option value="!" disabled selected>Escoja un Recurso.</option>
|
<option value="!" disabled selected>Choose a Resource</option>
|
||||||
|
|
||||||
<% for (Resource res: resourses) { %>
|
<% for (Resource res: resourses) { %>
|
||||||
<option value="<%= res.getKey() %>"><%= res.getUrl() %></option>
|
<option value="<%= res.getKey() %>"><%= res.getUrl() %></option>
|
||||||
@ -150,37 +144,13 @@
|
|||||||
</select>
|
</select>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<br />
|
<br />
|
||||||
<span style="color: darkorange; font-size: x-large">No hay Recursos disponibles.</span>
|
<span style="color: darkorange; font-size: x-large">No Resources registered.</span>
|
||||||
<script>buttonDisabled = true</script>
|
<script>buttonDisabled = true</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<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 />
|
<br />
|
||||||
|
|
||||||
<script>
|
<button id="sendButton" class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
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>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -188,7 +158,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../access" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../access" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,30 +13,30 @@
|
|||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
<title>Editar un Acceso - Hotel Services</title>
|
<title>Edit an Access - Hotel Services</title>
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -47,7 +47,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -58,8 +58,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -69,47 +69,41 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li class="active"><a href="" class="whiteLink">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Editar un Acceso</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Edit an Access</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<form id="mainForm" name="post" method="post" action="./edit" onsubmit="return safeSend()">
|
<form id="mainForm" name="post" method="post" action="edit" onsubmit="return safeSend()">
|
||||||
|
|
||||||
<input type="hidden" name="id" value="<%= a.getId() %>"/>
|
<input type="hidden" name="id" value="<%= a.getId() %>"/>
|
||||||
|
|
||||||
<input type="hidden" name="info" value="editar"/>
|
<input type="hidden" name="info" value="editar"/>
|
||||||
|
|
||||||
Nuevo Rol:
|
New Role:
|
||||||
<select id="formRole" name="rolesl" class="browser-default" oninput="accessExists()" required>
|
<select id="formRole" name="rolesl" class="browser-default" oninput="accessExists()" required>
|
||||||
<option value="!" disabled selected>Escoje un Rol</option>
|
<option value="!" disabled selected>Choose a Role</option>
|
||||||
<% if (roles.size() > 0) { %>
|
<% if (roles.size() > 0) { %>
|
||||||
|
|
||||||
<% for (Role r: roles) { %>
|
<% for (Role r: roles) { %>
|
||||||
@ -119,14 +113,14 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<span class="heading">No hay Roles.</span>
|
<span class="heading">There are no Roles.</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
Nuevo Recurso:
|
New Resource:
|
||||||
<select id="formResource" name="resourcesl" class="browser-default" oninput="accessExists()" required>
|
<select id="formResource" name="resourcesl" class="browser-default" oninput="accessExists()" required>
|
||||||
<option value="!" disabled selected>Escoge un Recurso</option>
|
<option value="!" disabled selected>Choose a Resource</option>
|
||||||
<% if (resources.size() > 0) { %>
|
<% if (resources.size() > 0) { %>
|
||||||
|
|
||||||
<% for (Resource res: resources) { %>
|
<% for (Resource res: resources) { %>
|
||||||
@ -136,52 +130,16 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<span class="heading">No hay Recursos.</span>
|
<span class="heading">There are no Access.</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select><br />
|
</select><br />
|
||||||
|
|
||||||
Estado:<br />
|
<button id="sendButton" class="btn waves-effect waves-light" type="submit" name="action">Edit
|
||||||
<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>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<hr />
|
|
||||||
<br />
|
|
||||||
<a href="../access" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,32 +12,32 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<title>Accesos - Hotel Services</title>
|
<title>Access - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -59,8 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -70,35 +70,28 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" onclick="postRedirect('./roles')">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
<li class="active"><a class="whiteLink">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('./users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="./roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="./users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="./resources">Recursos</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Accesos</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Access</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -115,13 +108,10 @@
|
|||||||
respDiv.style.backgroundColor = responseData["color"];
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
},1500);
|
},1500);
|
||||||
},10);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -131,15 +121,15 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style="float: left; display: inline;">
|
<div style="float: left; display: inline;">
|
||||||
<i class="material-icons large" style=" color: #3f51b5">info_outline</i>
|
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: x-large; clear: right; min-height: 87px;">
|
<div style="font-size: x-large; clear: right; min-height: 87px;">
|
||||||
El Rol "admin" tiene acceso total.
|
The admin Role has full access by default.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('/e/access/add')"><i class="material-icons left">add</i>Create</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/access/add')"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -168,19 +158,12 @@
|
|||||||
<td><%= e.getResourceName() %></td>
|
<td><%= e.getResourceName() %></td>
|
||||||
<td><%= e.getStatus() %></td>
|
<td><%= e.getStatus() %></td>
|
||||||
<td>
|
<td>
|
||||||
<a onclick="postRedirect('./access/view',{id: '<%=e.getId() %>'})" class="postLink">View</a> |
|
<a onclick="postRedirect('/access/view',{id: '<%=e.getId() %>'})" class="postLink">View</a> |
|
||||||
<a onclick="postRedirect('./access/edit',{id:'<%= e.getId() %>', info:'redirect'})" class="postLink">Edit</a> |
|
<a onclick="postRedirect('/access/edit',{id:'<%= e.getId() %>', info:'redirect'})" class="postLink">Edit</a> |
|
||||||
|
|
||||||
<form name="post_<%= e.getId() %>" style="display:none;" method="post" action="./access/delete"><input type="hidden" name="accessId" value="<%= e.getId() %>"/>
|
<form name="post_<%= e.getId() %>" style="display:none;" method="post" action="/access/delete"><input type="hidden" name="accessId" value="<%= e.getId() %>"/>
|
||||||
</form>
|
</form>
|
||||||
<a href="#" class="postLink" onclick="
|
<a href="#" class="postLink" onclick="if (confirm('Are you sure you want to delete # <%= e.getId() %>?')) { document.post_<%= e.getId() %>.submit(); } event.returnValue = false; return false;">Delete</a></td>
|
||||||
if (confirm('¿Estás seguro de que quieres eliminar #<%= e.getId() %>?')) {
|
|
||||||
document.post_<%= e.getId() %>.submit();
|
|
||||||
}
|
|
||||||
event.returnValue = false; return false;">
|
|
||||||
Delete
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@ -191,8 +174,6 @@
|
|||||||
<span class="heading">No Accesses registered.</span>
|
<span class="heading">No Accesses registered.</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,27 +10,27 @@
|
|||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
<title>Ver un Acceso</title>
|
<title>Insert title here</title>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -52,8 +52,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -63,47 +63,41 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li class="active"><a href="" class="whiteLink">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Ver un Acceso</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">View an Access</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
<div style="font-size: x-large">
|
||||||
ID: <%=access.getId()%><br />
|
ID: <%=access.getId()%><br />
|
||||||
Rol: <%=access.getRoleName()%><br />
|
Role: <%=access.getRoleName()%><br />
|
||||||
Recurso: <%= access.getResourceName() %>
|
Resource: <%= access.getResourceName() %>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<a href="../access" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../access" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,192 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="java.util.ArrayList" %>
|
|
||||||
<%@ page import="model.Transaction" %>
|
|
||||||
<%@ page import="controller.financesManagement.transactions.TransactionsControllerView" %>
|
|
||||||
<% User usuario = (User) request.getAttribute("User");
|
|
||||||
String serverResponse = (String) request.getAttribute("serverResponse");
|
|
||||||
ArrayList<String> transactionList = (ArrayList<String>) request.getAttribute("transactionList");
|
|
||||||
if (serverResponse == null) serverResponse = "!";
|
|
||||||
%>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Historial - Hotel Service</title>
|
|
||||||
|
|
||||||
<!--<link type="text/css" rel="stylesheet" href="./css/Diseno.css">-->
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Elements.css?v=2">
|
|
||||||
|
|
||||||
<script src="../js/GlobalJs.js" async defer></script>
|
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<style>
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
|
||||||
<div class="nav-wrapper">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('../e/users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="#">Historial de Compras</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Historial de compras</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%if (!serverResponse.equals("!")){ %>
|
|
||||||
|
|
||||||
<div id="serverResponse">
|
|
||||||
<div style="margin: 10px"></div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var respDiv = document.getElementById("serverResponse");
|
|
||||||
|
|
||||||
var responseData = JSON.parse('<%=serverResponse%>');
|
|
||||||
|
|
||||||
respDiv.style.backgroundColor = responseData["color"];
|
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "0";
|
|
||||||
},1500);
|
|
||||||
},300);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Mi Historial<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>Servicio</td>
|
|
||||||
<td>Precio</td>
|
|
||||||
<td>Fecha de compra</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody id="tableBody">
|
|
||||||
|
|
||||||
<% for (String key: transactionList) {
|
|
||||||
Transaction transaction = TransactionsControllerView.getTransaction(key);
|
|
||||||
%>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td><%=transaction.getServiceName()%></td>
|
|
||||||
<td><%=transaction.getServicePrice()%></td>
|
|
||||||
<td><%=transaction.getCreateDate()%></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,133 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="java.util.List" %>
|
|
||||||
<%@ page import="model.Role" %><%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User user = (User) request.getAttribute("User"); %>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Añadir un Empleado - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
|
||||||
<%= 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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="../roles">Administración de Usuarios</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="../services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../services">Servicios</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../employees">Empleados</a></li>
|
|
||||||
<li class="tab"><a href="../materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Crear un Empleado</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<form method="post" action="./add">
|
|
||||||
<input name="action" value="create" type="hidden">
|
|
||||||
|
|
||||||
Nombre del Empleado:<br>
|
|
||||||
<input name="Name" placeholder="Nombre" required><br>
|
|
||||||
|
|
||||||
Dni del Empleado:<br>
|
|
||||||
<input name="Dni" placeholder="Dni" pattern="[0-9]{8}" title="Ingrese su numero de DNI(8 digitos)" required><br>
|
|
||||||
|
|
||||||
Correo electrónico del Empleado:<br>
|
|
||||||
<input name="Email" placeholder="Correo Electrónico" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" title="caracteres@nombre del dominio" required=""><br>
|
|
||||||
|
|
||||||
Teléfono del Empleado:<br>
|
|
||||||
<input name="Phone" placeholder="Teléfono" type="number" pattern="[0-9]{6,9}" title="Ingrese un numero de 6 o 9 digitos" required=""><br>
|
|
||||||
|
|
||||||
<input type="hidden" name="userId" value="<%= user.getId() %>">
|
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Create
|
|
||||||
<i class="material-icons right">send</i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<hr />
|
|
||||||
<br />
|
|
||||||
<a href="../employees" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,175 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="java.util.List" %>
|
|
||||||
<%@ page import="model.Employee" %><%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User usuario = (User) request.getAttribute("User");
|
|
||||||
List<Employee> employeeList = (List<Employee>) request.getAttribute("EmployeesList");
|
|
||||||
String serverResponse = (String) request.getAttribute("serverResponse");
|
|
||||||
if (serverResponse == null) serverResponse = "!";
|
|
||||||
%>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Empleados - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css?v=2">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="./roles">Administración de Usuarios</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="./services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="./services">Servicios</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Empleados</a></li>
|
|
||||||
<li class="tab"><a href="./materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Empleados</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%if (!serverResponse.equals("!")){ %>
|
|
||||||
|
|
||||||
<div id="serverResponse">
|
|
||||||
<div style="margin: 10px"></div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var respDiv = document.getElementById("serverResponse");
|
|
||||||
|
|
||||||
var responseData = JSON.parse('<%=serverResponse%>');
|
|
||||||
|
|
||||||
respDiv.style.backgroundColor = responseData["color"];
|
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "0";
|
|
||||||
},1500);
|
|
||||||
},50);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('/e/employees/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>Nombre</td>
|
|
||||||
<td>DNI</td>
|
|
||||||
<td>Email</td>
|
|
||||||
<td>Teléfono</td>
|
|
||||||
<td>Creado Por</td>
|
|
||||||
<td>Actions</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<% for (Employee employee: employeeList) {%>
|
|
||||||
<tr>
|
|
||||||
<td><%= employee.getName()%></td>
|
|
||||||
<td><%= employee.getDni() %></td>
|
|
||||||
<td><%= employee.getEmail() %></td>
|
|
||||||
<td><%= employee.getPhone() %></td>
|
|
||||||
<td><%= employee.getCreatorUserName() %></td>
|
|
||||||
<td>
|
|
||||||
<a class="postLink" onclick="postRedirect('./employees/view',{action:'viewRedirect',employeeKey:'<%=employee.getKey()%>'})">View</a>
|
|
||||||
| <a class="postLink" onclick="postRedirect('./employees/view',{action:'editRedirect',employeeKey:'<%=employee.getKey()%>'})">Edit</a>
|
|
||||||
| <a class="postLink" onclick="postRedirect('./employees/delete',{employeeKey:'<%=employee.getKey()%>'})">Delete</a></td>
|
|
||||||
</tr>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,152 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="model.Employee" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<% Employee employee = (Employee) request.getAttribute("Employee");
|
|
||||||
User usuario = (User) request.getAttribute("User");
|
|
||||||
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
|
||||||
String action = (String) request.getAttribute("action");%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><%=action%> a Service - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="../roles">Administración de Usuarios</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="../services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../services">Servicios</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../employees">Empleados</a></li>
|
|
||||||
<li class="tab"><a href="../materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> un Servicio</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<% if (editAllowed) {%>
|
|
||||||
|
|
||||||
<form action="./add" method="post">
|
|
||||||
|
|
||||||
<input name="key" value="<%=employee.getKey()%>" type="hidden">
|
|
||||||
<input name="action" value="update" type="hidden">
|
|
||||||
|
|
||||||
Nombre del Servicio:<br />
|
|
||||||
<input name="Name" value="<%=employee.getName()%>" placeholder="Nombre" required><br/>
|
|
||||||
|
|
||||||
DNI del Empleado:<br />
|
|
||||||
<input name="Dni" type="number" min="0" required placeholder="Dni" value="<%= employee.getDni() %>"><br />
|
|
||||||
|
|
||||||
Correo electrónico del Empleado:<br />
|
|
||||||
<input name="Email" type="email" placeholder="Description" required value="<%= employee.getEmail() %>"><br />
|
|
||||||
|
|
||||||
Teléfono del Empleado:<br>
|
|
||||||
<input name="Phone" placeholder="Teléfono" type="number" pattern="[0-9]{6,9}" title="Ingrese un numero de 6 o 9 digitos"
|
|
||||||
required="" value="<%= employee.getPhone() %>">
|
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Editar
|
|
||||||
<i class="material-icons right">send</i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<% } else {%>
|
|
||||||
|
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
|
||||||
Nombre: <%= employee.getName() %><br />
|
|
||||||
Dni: <%= employee.getDni() %><br />
|
|
||||||
Correo electrónico: <%= employee.getEmail() %><br />
|
|
||||||
Creado por: <a style="cursor:pointer;" onclick="postRedirect('/e/users/view',{action:'viewRedirect',userID:'<%=employee.getCreatorUserId()%>'})"><%= employee.getCreatorUserName() %></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
<br />
|
|
||||||
<a href="../employees" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,139 +0,0 @@
|
|||||||
<%@ page import="model.Resource" %>
|
|
||||||
<%@ page import="model.User" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Jose
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User usuario = (User) request.getAttribute("User");
|
|
||||||
String serverResponse = (String) request.getAttribute("serverResponse");
|
|
||||||
if (serverResponse == null) serverResponse = "!";
|
|
||||||
%>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Finanzas - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="./roles">Administración de Usuarios</a></li>
|
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="#">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="#">Finanzas</a></li>
|
|
||||||
<li class="tab"><a href="./trans">Transacciones</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Finanzas</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%if (!serverResponse.equals("!")){ %>
|
|
||||||
|
|
||||||
<div id="serverResponse">
|
|
||||||
<div style="margin: 10px"></div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var respDiv = document.getElementById("serverResponse");
|
|
||||||
|
|
||||||
var responseData = JSON.parse('<%=serverResponse%>');
|
|
||||||
|
|
||||||
respDiv.style.backgroundColor = responseData["color"];
|
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "0";
|
|
||||||
},1500);
|
|
||||||
},50);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Incompleto. Faltan datos acerca de:<br />
|
|
||||||
<ol>
|
|
||||||
<li>Egresos mediante pagos a Empleados</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,149 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="model.Service" %>
|
|
||||||
<%@ page import="model.Material" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<% Material material = (Material) request.getAttribute("Material");
|
|
||||||
User usuario = (User) request.getAttribute("User");
|
|
||||||
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
|
||||||
String action = (String) request.getAttribute("action");%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><%=action%> un Material - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="../roles">Administración de Usuarios</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="../services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../services">Servicios</a></li>
|
|
||||||
<li class="tab"><a href="../employees">Empleados</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> un Material</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<% if (editAllowed) {%>
|
|
||||||
|
|
||||||
<form method="post" action="./add">
|
|
||||||
<input name="action" value="create" type="hidden">
|
|
||||||
|
|
||||||
Nombre del Material:<br />
|
|
||||||
<input name="Name" placeholder="Nombre" required value="<%= material.getName() %>"><br />
|
|
||||||
|
|
||||||
Cantidad:<br />
|
|
||||||
<input name="Amount" placeholder="Cantidad" type="number" min="0" required value="<%= material.getAmount() %>"><br />
|
|
||||||
|
|
||||||
Precio por unidad:<br />
|
|
||||||
<input name="Price" placeholder="Precio" type="number" required min="0" step="0.1" value="<%= material.getPrice() %>"><br />
|
|
||||||
|
|
||||||
Unidad (ejm. Kg, Litros):<br />
|
|
||||||
<input name="Unity" placeholder="Unidad" required value="<%= material.getUnity() %>"><br />
|
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action" >Editar
|
|
||||||
<i class="material-icons right">send</i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<% } else {%>
|
|
||||||
|
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
|
||||||
Nombre: <%= material.getName() %><br />
|
|
||||||
Cantidad: <%= material.getAmount() %><br />
|
|
||||||
Precio: <%= material.getPrice() %><br />
|
|
||||||
Unidad: <%= material.getUnity() %><br />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
<br />
|
|
||||||
<a href="../materials" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,129 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User user = (User) request.getAttribute("User"); %>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Añadir un Material - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="../roles">Administración de Usuarios</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="../services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../services">Servicios</a></li>
|
|
||||||
<li class="tab"><a href="../employees">Empleados</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../material">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Crear un Material</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<form method="post" action="./add">
|
|
||||||
<input name="action" value="create" type="hidden">
|
|
||||||
|
|
||||||
Nombre del Material:<br />
|
|
||||||
<input name="Name" placeholder="Nombre" required><br />
|
|
||||||
|
|
||||||
Precio por unidad:<br />
|
|
||||||
<input name="Price" placeholder="Precio" type="number" required min="0" step="0.1"><br />
|
|
||||||
|
|
||||||
Cantidad:<br />
|
|
||||||
<input name="Amount" placeholder="Cantidad" type="number" min="0" required><br />
|
|
||||||
|
|
||||||
Unidad (ejm. Kg, Litros):<br />
|
|
||||||
<input name="Unity" placeholder="Unidad" required><br />
|
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
|
|
||||||
<i class="material-icons right">send</i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<hr />
|
|
||||||
<br />
|
|
||||||
<a href="../materials" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,173 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="java.util.List" %>
|
|
||||||
<%@ page import="model.Material" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User usuario = (User) request.getAttribute("User");
|
|
||||||
List<Material> materialList = (List<Material>) request.getAttribute("materialList");
|
|
||||||
String serverResponse = (String) request.getAttribute("serverResponse");
|
|
||||||
if (serverResponse == null) serverResponse = "!";
|
|
||||||
%>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Materiales - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css?v=2">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="./roles">Administración de Usuarios</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="./services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="./services">Servicios</a></li>
|
|
||||||
<li class="tab"><a href="./employees">Empleados</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Materiales</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%if (!serverResponse.equals("!")){ %>
|
|
||||||
|
|
||||||
<div id="serverResponse">
|
|
||||||
<div style="margin: 10px"></div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var respDiv = document.getElementById("serverResponse");
|
|
||||||
|
|
||||||
var responseData = JSON.parse('<%=serverResponse%>');
|
|
||||||
|
|
||||||
respDiv.style.backgroundColor = responseData["color"];
|
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "0";
|
|
||||||
},1500);
|
|
||||||
},50);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('/e/materials/add',{action:'redirect'})"><i class="material-icons left">add</i>Crear</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>Nombre</td>
|
|
||||||
<td>Precio Unitario</td>
|
|
||||||
<td>Cantidad</td>
|
|
||||||
<td>Unidad</td>
|
|
||||||
<td>Fecha de Creación</td>
|
|
||||||
<td>Acciones</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<% for (Material material : materialList) {%>
|
|
||||||
<tr>
|
|
||||||
<td><%= material.getName()%></td>
|
|
||||||
<td><%= material.getPrice() %></td>
|
|
||||||
<td><%= material.getAmount() %></td>
|
|
||||||
<td><%= material.getUnity() %></td>
|
|
||||||
<td><%= material.getCreateDate() %></td>
|
|
||||||
<td>
|
|
||||||
<a class="postLink" onclick="postRedirect('./materials/view',{action:'viewRedirect',materialKey:'<%=material.getKey()%>'})">View</a>
|
|
||||||
| <a class="postLink" onclick="postRedirect('./materials/view',{action:'editRedirect',materialKey:'<%=material.getKey()%>'})">Edit</a>
|
|
||||||
| <a class="postLink" onclick="postRedirect('./materials/delete',{materialKey:'<%=material.getKey()%>'})">Delete</a></td>
|
|
||||||
</tr>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -11,31 +11,31 @@
|
|||||||
<% User user = (User) request.getAttribute("User"); %>
|
<% User user = (User) request.getAttribute("User"); %>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Añadir un Recurso - Hotel Services</title>
|
<title>Add a Resource - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -57,8 +57,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -68,76 +68,52 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a href="#" style="background-color: lightgray">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Añadir un Recurso</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Add a Resource</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<form method="post" action="./add">
|
<form method="post" action="./add">
|
||||||
<input name="action" value="create" type="hidden">
|
<input name="action" value="create" type="hidden">
|
||||||
|
|
||||||
URI del Recurso:<br />
|
Url of the Resource:<br />
|
||||||
<input name="url" placeholder="URI del Recurso" required><br />
|
<input name="url" placeholder="Url of the Resource" required><br />
|
||||||
Estado del Recurso:<br />
|
Status of the Resource:<br />
|
||||||
<br />
|
<select name="status" class="browser-default" required>
|
||||||
<div class="switch" id="siwtchContainer">
|
<option value="" disabled selected>Choose a status</option>
|
||||||
<label>
|
<option value="true">true</option>
|
||||||
Falso
|
<option value="false">false</option>
|
||||||
<input id="sivth" type="checkbox" name="status" value="false">
|
</select>
|
||||||
<span class="lever"></span>
|
|
||||||
Verdadero
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
|
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</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>
|
</form>
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../resources" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../resources" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,32 +16,32 @@
|
|||||||
%>
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Recursos - Hotel Services</title>
|
<title>Resources - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -63,8 +63,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -74,35 +74,29 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('./users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a href="#" style="background-color: lightgray">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="./roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="./users">Usuarios</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="./access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Recursos</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Resources</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -119,13 +113,10 @@
|
|||||||
respDiv.style.backgroundColor = responseData["color"];
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
},1500);
|
},1500);
|
||||||
},50);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -133,17 +124,17 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('/e/resources/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/resources/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
<table class="striped responsive-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>URI</td>
|
<td>URL</td>
|
||||||
<td>Estado</td>
|
<td>Status</td>
|
||||||
<td>Fecha de creación</td>
|
<td>Date created</td>
|
||||||
<td>Acciones</td>
|
<td>Actions</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -167,9 +158,9 @@
|
|||||||
<td><%= resource.getStatus()%></td>
|
<td><%= resource.getStatus()%></td>
|
||||||
<td><%= resource.getCreateDate()%></td>
|
<td><%= resource.getCreateDate()%></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="postLink" onclick="postRedirect('resources/view',{action:'viewRedirect',key:'<%=key%>'})">Ver</a>
|
<a class="postLink" onclick="postRedirect('resources/view',{action:'viewRedirect',key:'<%=key%>'})">View</a>
|
||||||
| <a class="postLink" onclick="postRedirect('resources/view',{action:'editRedirect',key:'<%=key%>'})">Editar</a>
|
| <a class="postLink" onclick="postRedirect('resources/view',{action:'editRedirect',key:'<%=key%>'})">Edit</a>
|
||||||
| <a class="postLink" onclick="postRedirect('resources/delete',{key:'<%=key%>'})">Eliminar</a></td>
|
| <a class="postLink" onclick="postRedirect('resources/delete',{key:'<%=key%>'})">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
@ -15,31 +15,31 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><%=action%> un Usuario - Hotel Services</title>
|
<title><%=action%> a User - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -61,8 +61,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -72,35 +72,28 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a href="#" style="background-color: lightgray">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> un Recurso</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a Resource</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -111,42 +104,18 @@
|
|||||||
<input name="key" value="<%=resource.getKey()%>" type="hidden">
|
<input name="key" value="<%=resource.getKey()%>" type="hidden">
|
||||||
<input name="action" value="update" type="hidden">
|
<input name="action" value="update" type="hidden">
|
||||||
|
|
||||||
URI:<br />
|
Url:<br />
|
||||||
<input name="url" value="<%=resource.getUrl()%>" placeholder="URI" required><br/>
|
<input name="url" value="<%=resource.getUrl()%>" placeholder="url" required><br/>
|
||||||
<br/>
|
<br/>
|
||||||
Estado:<br />
|
Status:<br />
|
||||||
<br />
|
<select name="status" class="browser-default" required>
|
||||||
<div class="switch" id="siwtchContainer">
|
<option value="" disabled selected>Choose a status</option>
|
||||||
<label>
|
<option value="true">true</option>
|
||||||
Falso
|
<option value="false">false</option>
|
||||||
<input id="sivth" type="checkbox" name="status" value="false">
|
</select>
|
||||||
<span class="lever"></span>
|
|
||||||
Verdadero
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<script>
|
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
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>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -156,7 +125,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
<div style="font-size: x-large">
|
||||||
Uri: <%=resource.getUrl()%><br />
|
Url: <%=resource.getUrl()%><br />
|
||||||
Status: <%=resource.getStatus()%><br />
|
Status: <%=resource.getStatus()%><br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -165,7 +134,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../resources" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../resources" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -8,33 +8,33 @@
|
|||||||
--%>
|
--%>
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<% User user = (User) request.getAttribute("User"); %>
|
<% User user = (User) request.getAttribute("User"); %>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Añadir un Rol - Hotel Services</title>
|
<title>Add a Role - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="#" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -45,7 +45,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -56,8 +56,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -67,76 +67,52 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li class="active"><a class="whiteLink" href="">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Crear un Role</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Create a Role</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<form method="post" action="./add">
|
<form method="post" action="./add">
|
||||||
<input name="action" value="create" type="hidden">
|
<input name="action" value="create" type="hidden">
|
||||||
|
|
||||||
Nombre del Rol:<br />
|
Name of the Role:<br />
|
||||||
<input name="roleName" placeholder="Nombre del Rol" required><br />
|
<input name="roleName" placeholder="Name of the Role" required><br />
|
||||||
Estado del Rol:<br />
|
Status of the Role:<br />
|
||||||
<br />
|
<select name="roleStatus" class="browser-default" required>
|
||||||
<div class="switch" id="siwtchContainer">
|
<option value="" disabled selected>Choose a status</option>
|
||||||
<label>
|
<option value="true">true</option>
|
||||||
Falso
|
<option value="false">false</option>
|
||||||
<input id="sivth" type="checkbox" name="roleStatus" value="false">
|
</select>
|
||||||
<span class="lever"></span>
|
|
||||||
Verdadero
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
|
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</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>
|
</form>
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../roles" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../roles" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,48 +15,31 @@
|
|||||||
%>
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<title>Roles - Hotel Services</title>
|
||||||
<title>Roles - Hotel Service</title>
|
|
||||||
|
|
||||||
<!--<link type="text/css" rel="stylesheet" href="./css/Diseno.css">-->
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Elements.css?v=2">
|
|
||||||
|
|
||||||
<script src="../js/GlobalJs.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<style>
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.transition{
|
|
||||||
overflow: hidden;
|
|
||||||
height: auto;
|
|
||||||
|
|
||||||
transition: max-height 250ms ease-in;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -67,7 +50,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -78,8 +61,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -89,29 +72,23 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
<li class="active"><a class="whiteLink" href="">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="#">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a onclick="postRedirect('./users')">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="#">Roles</a></li>
|
|
||||||
<li class="tab"><a href="./users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="./resources">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="./access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -134,12 +111,10 @@
|
|||||||
respDiv.style.backgroundColor = responseData["color"];
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
},1500);
|
},1500);
|
||||||
},10);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -147,17 +122,17 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('./roles/add',{action:'redirect'})"><i class="material-icons left">add</i>Crear</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/roles/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
<table class="striped responsive-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Nombre</td>
|
<td>Name</td>
|
||||||
<td>Estado</td>
|
<td>Status</td>
|
||||||
<td>Fecha de Creación</td>
|
<td>Date created</td>
|
||||||
<td>Acciones</td>
|
<td>Actions</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -184,45 +159,19 @@
|
|||||||
<td><%= roleKey.getStatus()%></td>
|
<td><%= roleKey.getStatus()%></td>
|
||||||
<td><%= roleKey.getCreateDate()%></td>
|
<td><%= roleKey.getCreateDate()%></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="postLink" onclick="postRedirect('./roles/view',{action:'viewRedirect',key:'<%=key%>'})">Ver</a>
|
<a class="postLink" onclick="postRedirect('roles/view',{action:'viewRedirect',key:'<%=key%>'})">View</a>
|
||||||
| <a class="postLink" onclick="postRedirect('./roles/view',{action:'editRedirect',key:'<%=key%>'})">Editar</a>
|
| <a class="postLink" onclick="postRedirect('roles/view',{action:'editRedirect',key:'<%=key%>'})">Edit</a>
|
||||||
| <a class="postLink" onclick="postRedirect('./roles/delete',{key:'<%=key%>'})">Eliminar</a></td>
|
| <a class="postLink" onclick="postRedirect('roles/delete',{key:'<%=key%>'})">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -14,31 +14,31 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><%=action%> un Rol - Hotel Services</title>
|
<title><%=action%> a User - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="#" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -60,8 +60,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -71,35 +71,30 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li class="active"><a class="whiteLink" href="/roles">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">
|
||||||
<div id="dropdownContent">
|
Show Services
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
</div>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<div id="dropdownContent">
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
</div>-->
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="../roles">Roles</a></li>
|
|
||||||
<li class="tab"><a href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> un Rol</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a Role</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -110,41 +105,18 @@
|
|||||||
<input name="key" value="<%=roleKey.getKey()%>" type="hidden">
|
<input name="key" value="<%=roleKey.getKey()%>" type="hidden">
|
||||||
<input name="action" value="update" type="hidden">
|
<input name="action" value="update" type="hidden">
|
||||||
|
|
||||||
Nombre:<br />
|
Name:<br />
|
||||||
<input name="roleName" value="<%=roleKey.getName()%>" placeholder="Nombre" required><br/>
|
<input name="roleName" value="<%=roleKey.getName()%>" placeholder="Name" required><br/>
|
||||||
Estado:<br />
|
<br/>
|
||||||
<br />
|
Status:<br />
|
||||||
<div class="switch" id="siwtchContainer">
|
<select name="roleStatus" class="browser-default" required>
|
||||||
<label>
|
<option value="" disabled selected>Choose a status</option>
|
||||||
Falso
|
<option value="true">true</option>
|
||||||
<input id="sivth" type="checkbox" name="roleStatus" value="false">
|
<option value="false">false</option>
|
||||||
<span class="lever"></span>
|
</select>
|
||||||
Verdadero
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<script>
|
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
document.getElementById("siwtchContainer").addEventListener("mouseup",changeSwitch);
|
|
||||||
var elSwitch = document.getElementById("sivth");
|
|
||||||
|
|
||||||
if ("<%=roleKey.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>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -155,7 +127,7 @@
|
|||||||
|
|
||||||
<div style="font-size: x-large">
|
<div style="font-size: x-large">
|
||||||
Name: <%=roleKey.getName()%><br />
|
Name: <%=roleKey.getName()%><br />
|
||||||
Status: <%=roleKey.getStatus()%><br />
|
Email: <%=roleKey.getStatus()%><br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -163,7 +135,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../roles" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../roles" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<%@ page import="model.User" %>
|
<%@ page import="model.User" %>
|
||||||
<%--
|
<%@ page import="java.util.List" %>
|
||||||
|
<%@ page import="model.Role" %><%--
|
||||||
Created by IntelliJ IDEA.
|
Created by IntelliJ IDEA.
|
||||||
User: Fernando
|
User: Fernando
|
||||||
Date: 07/06/2018
|
Date: 07/06/2018
|
||||||
@ -10,43 +11,39 @@
|
|||||||
<% User user = (User) request.getAttribute("User"); %>
|
<% User user = (User) request.getAttribute("User"); %>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Crear un Servicio - Hotel Services</title>
|
<title>Add a Service - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons">arrow_drop_down</i>
|
<i class="material-icons right">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('../view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -57,8 +54,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -68,59 +65,53 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="../services">Servicios</a></li>
|
|
||||||
<li class="tab"><a href="../employees">Empleados</a></li>
|
|
||||||
<li class="tab"><a href="../materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Crear un Servicio</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Create a Service</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<form method="post" action="./add">
|
<form method="post" action="./add">
|
||||||
<input name="action" value="create" type="hidden">
|
<input name="action" value="create" type="hidden">
|
||||||
|
|
||||||
Nombre del Servicio:<br />
|
Name of the Service:<br />
|
||||||
<input name="Name" placeholder="Nombre" required><br />
|
<input name="Name" placeholder="Name" required><br />
|
||||||
|
|
||||||
Precio del Servicio:<br />
|
Price of the Service:<br />
|
||||||
<input name="Price" placeholder="Precio" type="number" required min="0" step="0.1"><br />
|
<input name="Price" placeholder="Price" type="number" required min="0" step="0.1"><br />
|
||||||
|
|
||||||
Descripción del Servicio:<br />
|
Description of the Service:<br />
|
||||||
<input name="Description" placeholder="Descripción" required><br />
|
<input name="Description" placeholder="Description" required><br />
|
||||||
|
|
||||||
<input type="hidden" name="userId" value="<%=user.getId()%>">
|
<input type="hidden" name="userId" value="<%=user.getId()%>">
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
|
<button class="btn waves-effect waves-light" type="submit" name="action">Create
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../services" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../services" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,32 +15,32 @@
|
|||||||
%>
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Servicios - Hotel Services</title>
|
<title>Services - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css?v=2">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css?v=2">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -62,8 +62,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -73,34 +73,29 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" href="./roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="./services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="#">Servicios</a></li>
|
|
||||||
<li class="tab"><a href="./employees">Empleados</a></li>
|
|
||||||
<li class="tab"><a href="./materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Servicios</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Services</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -117,13 +112,10 @@
|
|||||||
respDiv.style.backgroundColor = responseData["color"];
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
},1500);
|
},1500);
|
||||||
},50);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -131,18 +123,18 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('/e/services/add',{action:'redirect'})"><i class="material-icons left">add</i>Crear</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/services/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
<table class="striped responsive-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Nombre</td>
|
<td>Name</td>
|
||||||
<td>Precio</td>
|
<td>Price</td>
|
||||||
<td>Descripción</td>
|
<td>Description</td>
|
||||||
<td>Creado por</td>
|
<td>Created by</td>
|
||||||
<td>Acciones</td>
|
<td>Actions</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -155,9 +147,9 @@
|
|||||||
<td><%= service.getDescription() %></td>
|
<td><%= service.getDescription() %></td>
|
||||||
<td><%= service.getCreatorUserName() %></td>
|
<td><%= service.getCreatorUserName() %></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="postLink" onclick="postRedirect('services/view',{action:'viewRedirect',serviceKey:'<%=service.getKey()%>'})">Ver</a>
|
<a class="postLink" onclick="postRedirect('services/view',{action:'viewRedirect',serviceKey:'<%=service.getKey()%>'})">View</a>
|
||||||
| <a class="postLink" onclick="postRedirect('services/view',{action:'editRedirect',serviceKey:'<%=service.getKey()%>'})">Editar</a>
|
| <a class="postLink" onclick="postRedirect('services/view',{action:'editRedirect',serviceKey:'<%=service.getKey()%>'})">Edit</a>
|
||||||
| <a class="postLink" onclick="postRedirect('services/delete',{serviceKey:'<%=service.getKey()%>'})">Eliminar</a></td>
|
| <a class="postLink" onclick="postRedirect('services/delete',{serviceKey:'<%=service.getKey()%>'})">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
@ -21,24 +21,24 @@
|
|||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -60,8 +60,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -71,34 +71,30 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" href="../roles">Administración de Usuarios</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">
|
||||||
<div id="dropdownContent">
|
Show Services
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
</div>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<div id="dropdownContent">
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
</div>-->
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab active"><a class="active" href="../services">Servicios</a></li>
|
|
||||||
<li class="tab"><a href="../employees">Empleados</a></li>
|
|
||||||
<li class="tab"><a href="../materials">Materiales</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> un Servicio</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a Service</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -109,17 +105,17 @@
|
|||||||
<input name="key" value="<%=service.getKey()%>" type="hidden">
|
<input name="key" value="<%=service.getKey()%>" type="hidden">
|
||||||
<input name="action" value="update" type="hidden">
|
<input name="action" value="update" type="hidden">
|
||||||
|
|
||||||
Nombre del Servicio:<br />
|
Name of the Service:<br />
|
||||||
<input name="Name" value="<%=service.getName()%>" placeholder="Nombre" required><br/>
|
<input name="Name" value="<%=service.getName()%>" placeholder="Name" required><br/>
|
||||||
|
|
||||||
Precio del Servicio:<br />
|
Price of the Service:<br />
|
||||||
<input name="Price" type="number" min="0" step="0.1" required placeholder="Precio" value="<%= service.getPrice() %>"><br />
|
<input name="Price" type="number" min="0" step="0.1" required placeholder="Price" value="<%= service.getPrice() %>"><br />
|
||||||
|
|
||||||
Descripción del Servicio:<br />
|
Description of the Service:<br />
|
||||||
<input name="Description" placeholder="Descripción" required value="<%= service.getDescription() %>"><br />
|
<input name="Description" placeholder="Description" required value="<%= service.getDescription() %>"><br />
|
||||||
|
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Editar
|
<button class="btn waves-effect waves-light" type="submit" name="action">Edit
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -129,10 +125,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
<div style="font-size: x-large">
|
||||||
Nombre: <%= service.getName() %><br />
|
Name: <%= service.getName() %><br />
|
||||||
Precio: <%= service.getPrice() %><br />
|
Price: <%= service.getPrice() %><br />
|
||||||
Descripción: <%= service.getDescription() %><br />
|
Description: <%= service.getDescription() %><br />
|
||||||
Creado por: <a style="cursor:pointer;" onclick="postRedirect('/e/users/view',{action:'viewRedirect',userID:'<%=service.getCreatorUserId()%>'})"><%= service.getCreatorUserName() %></a>
|
Created by: <a style="cursor:pointer;" onclick="postRedirect('/users/view',{action:'viewRedirect',userID:'<%=service.getCreatorUserId()%>'})"><%= service.getCreatorUserName() %></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -140,7 +136,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../services" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../roles" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,165 +0,0 @@
|
|||||||
<%@ page import="model.Resource" %>
|
|
||||||
<%@ page import="model.User" %>
|
|
||||||
<%@ page import="model.Transaction" %>
|
|
||||||
<%@ page import="java.util.List" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Jose
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User usuario = (User) request.getAttribute("User");
|
|
||||||
List<Transaction> transitionList = (List<Transaction>) request.getAttribute("transactionsList");
|
|
||||||
String serverResponse = (String) request.getAttribute("serverResponse");
|
|
||||||
if (serverResponse == null) serverResponse = "!";
|
|
||||||
%>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Transacciones - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="./roles">Administración de Usuarios</a></li>
|
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
|
||||||
<li class="active"><a class="whiteLink active" href="#">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="./reports">Finanzas</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="#">Transacciones</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Transacciones</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%if (!serverResponse.equals("!")){ %>
|
|
||||||
|
|
||||||
<div id="serverResponse">
|
|
||||||
<div style="margin: 10px"></div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var respDiv = document.getElementById("serverResponse");
|
|
||||||
|
|
||||||
var responseData = JSON.parse('<%=serverResponse%>');
|
|
||||||
|
|
||||||
respDiv.style.backgroundColor = responseData["color"];
|
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "0";
|
|
||||||
},1500);
|
|
||||||
},50);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>ID del Usuario</td>
|
|
||||||
<td>Servicio</td>
|
|
||||||
<td>Costo</td>
|
|
||||||
<td>Fecha de facturación</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<% for (Transaction transaction: transitionList) {%>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td><%=transaction.getUserID()%></td>
|
|
||||||
<td><%=transaction.getServiceName()%></td>
|
|
||||||
<td><%=transaction.getServicePrice()%></td>
|
|
||||||
<td><%=transaction.getCreateDate()%></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -12,43 +12,39 @@
|
|||||||
<% List<Role> roles = (List<Role>) request.getAttribute("Roles"); %>
|
<% List<Role> roles = (List<Role>) request.getAttribute("Roles"); %>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Crear un Usuario - Hotel Services</title>
|
<title>Add a User - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
</span>
|
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons">arrow_drop_down</i>
|
<i class="material-icons right">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('../view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -59,8 +55,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -70,49 +66,42 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="../roles">Administración de Usuarios</a></li>
|
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Crear un Usuario</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Create a User</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<form method="post" action="./add">
|
<form method="post" action="./add">
|
||||||
<input name="action" value="create" type="hidden">
|
<input name="action" value="create" type="hidden">
|
||||||
|
|
||||||
Nombre del Usuario:<br />
|
Name of the User:<br />
|
||||||
<input name="userName" placeholder="Nombre" required><br />
|
<input name="userName" placeholder="Name of the User" required><br />
|
||||||
Correo electrónico del Usuario:<br />
|
Email of the User:<br />
|
||||||
<input name="userEmail" placeholder="Correo electrónico" type="email" required>
|
<input name="userEmail" placeholder="Email" type="email" required>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col l10 m10">
|
<div class="col l10 m10">
|
||||||
Imagen<br />
|
Profile Image link<br />
|
||||||
<input name="userImg" value="https://i.stack.imgur.com/34AD2.jpg" placeholder="Link" required oninput="cambiarImg(this)"><br />
|
<input name="userImg" value="https://i.stack.imgur.com/34AD2.jpg" placeholder="Link" required oninput="cambiarImg(this)"><br />
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
@ -121,23 +110,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Role del Usuario:<br />
|
Role of the User:<br />
|
||||||
<select name="userRole" class="browser-default" required>
|
<select name="userRole" class="browser-default" required>
|
||||||
<option value="" disabled selected>Escoje un Rol</option>
|
<option value="" disabled selected>Choose a Role</option>
|
||||||
<% for(Role roleKey: roles){ %>
|
<% for(Role roleKey: roles){ %>
|
||||||
<option value="<%=roleKey.getKey()%>"><%=roleKey.getName()%></option>
|
<option value="<%=roleKey.getKey()%>"><%=roleKey.getName()%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Crear
|
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../users" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../users" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,32 +14,32 @@
|
|||||||
%>
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Usuarios - Hotel Services</title>
|
<title>Users - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Elements.css?v=2">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css?v=2">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" 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" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -61,8 +61,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -72,35 +72,29 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="./">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active">Administración de Usuarios</a></li>
|
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="./roles">Roles</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="./resources">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="./access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Usuarios</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Users</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -117,13 +111,10 @@
|
|||||||
respDiv.style.backgroundColor = responseData["color"];
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
},1500);
|
},1500);
|
||||||
},50);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -131,18 +122,18 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink indigo darken-1" onclick="postRedirect('/e/users/add',{action:'redirect'})"><i class="material-icons left">add</i>Crear</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/users/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table class="striped responsive-table">
|
<table class="striped responsive-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Nombre</td>
|
<td>Name</td>
|
||||||
<td>Correo electrónico</td>
|
<td>Email</td>
|
||||||
<td>Rol</td>
|
<td>Role</td>
|
||||||
<td>Imagen</td>
|
<td>Img</td>
|
||||||
<td>Acciones</td>
|
<td>Actions</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -158,9 +149,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><img src="<%= user.getImgUrl()%>" width="55px"/></td>
|
<td><img src="<%= user.getImgUrl()%>" width="55px"/></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="postLink" onclick="postRedirect('users/view',{action:'viewRedirect',userID:'<%=user.getId()%>'})">Ver</a>
|
<a class="postLink" onclick="postRedirect('users/view',{action:'viewRedirect',userID:'<%=user.getId()%>'})">View</a>
|
||||||
| <a class="postLink" onclick="postRedirect('users/view',{action:'editRedirect',userID:'<%=user.getId()%>'})">Editar</a>
|
| <a class="postLink" onclick="postRedirect('users/view',{action:'editRedirect',userID:'<%=user.getId()%>'})">Edit</a>
|
||||||
| <a class="postLink" onclick="postRedirect('users/delete',{userID:'<%=user.getId()%>'})">Eliminar</a></td>
|
| <a class="postLink" onclick="postRedirect('users/delete',{userID:'<%=user.getId()%>'})">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
@ -16,34 +16,34 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><%=action%> un Usuario - Hotel Services</title>
|
<title><%=action%> a Role - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../../css/Elements.css">
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<script src="../../js/GlobalJs.js" defer></script>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px">
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('../users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -63,8 +63,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li style="max-height: 62px">
|
<li>
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
<title id="simpleicons-github-icon">
|
<title id="simpleicons-github-icon">
|
||||||
GitHub icon
|
GitHub icon
|
||||||
@ -74,35 +74,28 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="whiteLink" href="../">Inicio</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink active" href="#">Administración de Usuarios</a></li>
|
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
||||||
<li><a class="whiteLink" href="../services">Administración de recursos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
<li><a class="whiteLink" href="../reports">Reportes de Ingresos</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
<div id="dropdownContent">
|
<div id="dropdownContent">
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-content" style="background-color: #3949a3">
|
|
||||||
<ul class="tabs tabs-transparent">
|
|
||||||
<li class="tab"><a href="../roles">Roles</a></li>
|
|
||||||
<li class="tab active"><a class="active" href="../users">Usuarios</a></li>
|
|
||||||
<li class="tab"><a href="../resources">Recursos</a></li>
|
|
||||||
<li class="tab"><a href="../access">Accesos</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> un Usuario</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a User</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -113,11 +106,11 @@
|
|||||||
<input name="userID" value="<%=user.getId()%>" type="hidden">
|
<input name="userID" value="<%=user.getId()%>" type="hidden">
|
||||||
<input name="action" value="update" type="hidden">
|
<input name="action" value="update" type="hidden">
|
||||||
|
|
||||||
Nombre:<br />
|
Name:<br />
|
||||||
<input name="userName" value="<%=user.getName()%>" placeholder="Nombre" required><br/>
|
<input name="userName" value="<%=user.getName()%>" placeholder="Name" required><br/>
|
||||||
<br/>
|
<br/>
|
||||||
Correo electrónico:<br />
|
Email:<br />
|
||||||
<input name="userEmail" value="<%=user.getEmail()%>" placeholder="Correo electrónico" type="email" required><br />
|
<input name="userEmail" value="<%=user.getEmail()%>" placeholder="Email" type="email" required><br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -131,16 +124,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Rol del Usuario:<br />
|
Role of the User:<br />
|
||||||
<select name="userRole" class="browser-default" required>
|
<select name="userRole" class="browser-default" required>
|
||||||
<option value="" disabled selected>Escoje un Rol</option>
|
<option value="" disabled selected>Choose a Role</option>
|
||||||
<% for(Role roleKey: roles){ %>
|
<% for(Role roleKey: roles){ %>
|
||||||
<option value="<%=roleKey.getKey()%>"><%=roleKey.getName()%></option>
|
<option value="<%=roleKey.getKey()%>"><%=roleKey.getName()%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<button class="btn waves-effect waves-light indigo darken-1" type="submit" name="action">Editar
|
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
|
||||||
<i class="material-icons right">send</i>
|
<i class="material-icons right">send</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -150,9 +143,9 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col l8 m8" style="font-size: x-large">
|
<div class="col l8 m8" style="font-size: x-large">
|
||||||
Nombre: <%=user.getName()%><br />
|
Name: <%=user.getName()%><br />
|
||||||
Correo electrónico: <%=user.getEmail()%><br />
|
Email: <%=user.getEmail()%><br />
|
||||||
Rol: <%= user.getRoleName()%><br />
|
Role: <%= user.getRoleName()%><br />
|
||||||
</div>
|
</div>
|
||||||
<div class="col l4 m4">
|
<div class="col l4 m4">
|
||||||
<img src="<%=user.getImgUrl()%>" width="96px"><br />
|
<img src="<%=user.getImgUrl()%>" width="96px"><br />
|
||||||
@ -164,7 +157,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<br />
|
<br />
|
||||||
<a href="../users" class="waves-effect waves-light btn whiteLink indigo darken-1"><i class="material-icons left">arrow_back</i>Volver</a>
|
<a href="../users" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -177,6 +170,5 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,188 +0,0 @@
|
|||||||
<%@ page import="model.User" %>
|
|
||||||
<%--
|
|
||||||
Created by IntelliJ IDEA.
|
|
||||||
User: Fernando
|
|
||||||
Date: 07/06/2018
|
|
||||||
Time: 16:39
|
|
||||||
To change this template use File | Settings | File Templates.
|
|
||||||
--%>
|
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
||||||
<% User user = (User) request.getAttribute("User");
|
|
||||||
String serverResponse = (String) request.getAttribute("serverResponse");
|
|
||||||
if (serverResponse == null) serverResponse = "!";
|
|
||||||
%>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<title>Area de Empleados - Hotel Services</title>
|
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
||||||
|
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Elements.css">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.cards{
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 3px;
|
|
||||||
box-shadow: 2px 2px lightgray;
|
|
||||||
background: -moz-linear-gradient(left, #3949a3 55%, white 90%);
|
|
||||||
background: -webkit-linear-gradient(left, #3949a3 55%, white 90%);
|
|
||||||
}
|
|
||||||
.cards a{
|
|
||||||
text-decoration: underline;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="nav-extended" style="background-color: #3f51b5">
|
|
||||||
<div class="nav-wrapper" style="max-height: 64px">
|
|
||||||
<a class="whiteLink hide-on-small-only" href="/" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
|
||||||
Empleados
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 180px;" onclick="changeUserOptions()">
|
|
||||||
|
|
||||||
<span id="nombreUsuario" style="min-width: 80px;">
|
|
||||||
<%= 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>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
|
||||||
width: auto; display: none;">
|
|
||||||
<ul style="color: black">
|
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesión</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
|
||||||
<i class="small material-icons">arrow_drop_up</i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
|
||||||
<li style="max-height: 62px">
|
|
||||||
<a href="https://github.com/Grupo-PW2/Web-Hostal" target="_blank" style="max-height: 62px">
|
|
||||||
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<title id="simpleicons-github-icon">
|
|
||||||
GitHub icon
|
|
||||||
</title>
|
|
||||||
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
|
||||||
</path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="active"><a class="whiteLink" href="#">Inicio</a></li>
|
|
||||||
<li><a class="whiteLink" href="./roles">Administración de Usuarios</a></li>
|
|
||||||
<li><a class="whiteLink" href="./services">Administración de recursos</a></li>
|
|
||||||
<li><a class="whiteLink" href="./reports">Reportes de Ingresos</a></li>
|
|
||||||
<li>|</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
|
||||||
<div id="dropdownContent">
|
|
||||||
<a href="#" onclick="postRedirect('./roles')">Roles</a>
|
|
||||||
<a href="#" style="background-color: lightgray">Users</a>
|
|
||||||
<a onclick="postRedirect('./resources')">Resources</a>
|
|
||||||
<a onclick="postRedirect('./access')">Access</a>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div></nav>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<br />
|
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Area de Empleados</span>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%if (!serverResponse.equals("!")){ %>
|
|
||||||
|
|
||||||
<div id="serverResponse">
|
|
||||||
<div style="margin: 10px"></div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var respDiv = document.getElementById("serverResponse");
|
|
||||||
|
|
||||||
var responseData = JSON.parse('<%=serverResponse%>');
|
|
||||||
|
|
||||||
respDiv.style.backgroundColor = responseData["color"];
|
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "500px";
|
|
||||||
setTimeout(function () {
|
|
||||||
respDiv.style.maxHeight = "0";
|
|
||||||
},1500);
|
|
||||||
},300);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<% } %>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div style="padding: 10px 15px">
|
|
||||||
<div class="row cards">
|
|
||||||
<div class="col l9 m9 s8" style="color: white; font-size: large">
|
|
||||||
<span style="font-size: x-large">Administración de Usuarios</span><br />
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<a href="./roles">Roles</a><br/>
|
|
||||||
<a href="./users">Usuarios</a><br/>
|
|
||||||
<a href="./resources">Recursos</a><br/>
|
|
||||||
<a href="./access">Accesos</a><br/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col l3 m3 s4 right-align">
|
|
||||||
<i class="material-icons" style="font-size: 8rem; color: #3949a3">people</i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row cards">
|
|
||||||
<div class="col l9 m9 s8" style="color: white; font-size: large">
|
|
||||||
<span style="font-size: x-large">Administración de Recursos</span><br />
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<a href="./services">Servicios</a><br/>
|
|
||||||
<a href="./employees">Empleados</a><br/>
|
|
||||||
<a href="./materials">Materiales</a><br/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col l3 m3 s4 right-align">
|
|
||||||
<i class="material-icons" style="font-size: 8rem; color: #3949a3">archive</i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row cards">
|
|
||||||
<div class="col l9 m9 s8" style="color: white; font-size: large">
|
|
||||||
<span style="font-size: x-large">Reportes de Ingresos</span><br />
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<a href="./reports">Finanzas</a><br/>
|
|
||||||
<a href="./trans">Transacciones</a><br/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col l3 m3 s4 right-align">
|
|
||||||
<i class="material-icons" style="font-size: 8rem; color: #3949a3">attach_money</i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
|
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
|
||||||
<application>hotel-service-210413</application>
|
<application>lab08-20173373</application>
|
||||||
<version>1</version>
|
<version>2</version>
|
||||||
<sessions-enabled>true</sessions-enabled>
|
<sessions-enabled>true</sessions-enabled>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
BIN
war/WEB-INF/classes/controller/access/AccessControllerAdd.class
Normal file
BIN
war/WEB-INF/classes/controller/access/AccessControllerAdd.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
war/WEB-INF/classes/controller/access/AccessControllerView.class
Normal file
BIN
war/WEB-INF/classes/controller/access/AccessControllerView.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/roles/RolesControllerAdd.class
Normal file
BIN
war/WEB-INF/classes/controller/roles/RolesControllerAdd.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/roles/RolesControllerDelete.class
Normal file
BIN
war/WEB-INF/classes/controller/roles/RolesControllerDelete.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/roles/RolesControllerIndex.class
Normal file
BIN
war/WEB-INF/classes/controller/roles/RolesControllerIndex.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/roles/RolesControllerView.class
Normal file
BIN
war/WEB-INF/classes/controller/roles/RolesControllerView.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/users/UsersControllerAdd.class
Normal file
BIN
war/WEB-INF/classes/controller/users/UsersControllerAdd.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/users/UsersControllerDelete.class
Normal file
BIN
war/WEB-INF/classes/controller/users/UsersControllerDelete.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/users/UsersControllerIndex.class
Normal file
BIN
war/WEB-INF/classes/controller/users/UsersControllerIndex.class
Normal file
Binary file not shown.
BIN
war/WEB-INF/classes/controller/users/UsersControllerView.class
Normal file
BIN
war/WEB-INF/classes/controller/users/UsersControllerView.class
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user