You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

93 lines
4.4 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/XHtml.xhtml to edit this template
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<body>
<f:view>
<header style="display: flex; justify-content: center; font-size: 30px;"><strong>Roles</strong></header>
<p:divider/>
<main style="display: flex; justify-content: space-between; gap: 10px;">
<h:form id="rolForm">
<p:growl id="messages" showDetail="true" for="mensajeRoles"/>
<p:dataTable id="table" value="#{demoBeanRoles.roles}" var="item" style="width: 600px"
paginator="true" rows="5" rowSelectMode="add" paginatorPosition="bottom">
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Rol"/>
</f:facet>
<h:outputText value="#{item.rol}"/>
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Estado"/>
</f:facet>
<h:outputText value="#{item.estado == 2 ? 'Activo':'Inactivo'}"/>
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton action="#{demoBeanRoles.eliminarRol(item)}" icon="pi pi-trash" style="margin-left: 5px" styleClass="ui-button-warning"
update="table"
ajax="true"/>
</p:column>
</p:dataTable>
</h:form>
<h:form style="margin-top: 20px;">
<header style="display: flex; justify-content: center;">Nuevo Rol</header>
<p:divider/>
<h:panelGrid columns="2" cellpadding="7">
<p:outputLabel value="Rol:" for="rol" />
<p:inputText id="rol" value="#{demoBeanRoles.rol.rol}" title="Rol" required="true"
requiredMessage="Este campo no puede estar vacio"
validatorMessage="entrada no valida"
>
<f:validateRegex pattern="^\b[A-ZÁÉÍÓÚÜÑ][a-záéíóúüñ]{1,}\b$"
for="apellidoPaterno" />
</p:inputText>
<p:outputLabel></p:outputLabel>
<p:message id="rols" for="rol"/>
</h:panelGrid>
<footer style="display: flex; margin-top: 280px; justify-content: flex-end;"> <!-- alinear a derecha -->
<p:commandButton action="#{demoBeanRoles.agregarRol()}" update="rolForm:table,rol,rols,rolForm:messages" rendered="#{demoBeanRoles.nuevo}"
styleClass="ui-button-success" style="width: 50px;"
icon="pi pi-save" ajax="true"
/>
<p:commandButton oncomplete="PF('rol').close()" immediate="true" style="margin-left: 5px; width: 50px; " icon="pi pi-times" styleClass="ui-button-danger"
ajax="false"/>
</footer>
</h:form>
</main>
</f:view>
</body>
</html>