<?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> <main style="display: flex; justify-content: space-between;"> <h:form id="tipT"> <p:growl id="messages" showDetail="true" for="tipoM"/> <p:dataTable id="table" value="#{demoBeanTipo.tipos}" var="item" style="width: 600px" paginator="true" rows="5" rowSelectMode="add" paginatorPosition="bottom"> <h1><h:outputText value="List"/></h1> <p:column> <f:facet name="header"> <h:outputText value="Id"/> </f:facet> <h:outputText value="#{item.id}"/> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Tipo"/> </f:facet> <h:outputText value="#{item.tipo}"/> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Opciones"/> </f:facet> <p:commandButton action="#{demoBeanTipo.eliminarTipo(item)}" icon="pi pi-trash" style="margin-left: 5px" styleClass="ui-button-danger" oncomplete="PF('tipo').show()" update="table" ajax="true"/> </p:column> </p:dataTable> </h:form> <h:form style="margin-left: 20px; margin-top: 20px;"> <header style="display: flex; justify-content: center;">Nuevo tipo</header> <p:divider/> <h:panelGrid columns="3" cellpadding="7"> <p:outputLabel value="Tipo" for="tipo" /> <p:inputText id="tipo" value="#{demoBeanTipo.tipo.tipo}" title="Tipo" 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:message id="tipos" for="tipo"/> </h:panelGrid> <footer style="display: flex; margin-top: 340px; justify-content: flex-end;"> <!-- alinear a derecha --> <p:commandButton action="#{demoBeanTipo.agregar()}" update="tipT:table,tipo,tipos,tipT:messages" rendered="#{demoBeanTipo.nuevo}" styleClass="ui-button-success" style="width: 50px;" icon="pi pi-save" ajax="true" /> <p:commandButton oncomplete="pf('tipo').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>