diff --git a/backoffice/src/main/webapp/jsf/gestionhechos.xhtml b/backoffice/src/main/webapp/jsf/gestionhechos.xhtml index c0f0b4741044290cdef8c7d5b436751586ef707e..0efbe0c3eb76d683deac361337b31ac6bc9477ff 100644 --- a/backoffice/src/main/webapp/jsf/gestionhechos.xhtml +++ b/backoffice/src/main/webapp/jsf/gestionhechos.xhtml @@ -46,7 +46,7 @@ <p:growl id="message" showDetail="true" /> - <p:commandButton value="Enviar Verificación" action="#{hecho.setEstado()}" update="@form" disabled="#{noticia.EstaVerifcado()}" > + <p:commandButton value="Enviar Verificación" action="#{hecho.setEstado()}" update="@form" disabled="#{hecho.EstaVerifcado()}" > <p:confirm header="Confirmar" message="¿Enviar Solicitud?" icon="pi pi-exclamation-triangle" /> </p:commandButton> @@ -54,10 +54,20 @@ <p:commandButton value="Si" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" /> <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" /> </p:confirmDialog> + </p:column> </p:dataTable> </h:form> + + + + + <h:form style="margin-top:10px;text-align: center" var="noticia" > + + <h:commandButton value="PUBLICAR/CANCELAR HECHO" action="publicarcancelar.xhtml?faces-redirect=true" + update="form" async="true" process="@this" visible="#{userLoginView.user.role.name.equals('SUBMITTER')}"/> + </h:form> </ui:define> </ui:decorate> </body> diff --git a/backoffice/src/main/webapp/jsf/publicarcancelar.xhtml b/backoffice/src/main/webapp/jsf/publicarcancelar.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..c052c2ba9a447b5da6d00c8f69f3823696b1f9b4 --- /dev/null +++ b/backoffice/src/main/webapp/jsf/publicarcancelar.xhtml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:p="http://primefaces.org/ui" + xmlns:h="http://xmlns.jcp.org/jsf/html" + xmlns:f="http://xmlns.jcp.org/jsf/core" +> + +<ui:decorate template="/WEB-INF/templates/template.xhtml"> + <ui:define name="contenido"> + <h:form> + <p:outputPanel style="font-size: 30px;text-align: center"> + <h:outputText value="Cancelar/Publicar Hechos"/> + </p:outputPanel> + + <p:dataTable var="hecho" id="dataHecho" value="#{gestionHechos.facts}" widgetVar="NoticiasTable" + emptyMessage="Hecho no encontrada" filteredValue="#{gestionHechos.filteredFacts}"> + + + <p:column filterBy="#{hecho.title}" headerText="Titulo" filterMatchMode="contains" visible="#{!hecho.EstaVerifcado()}"> + <h:outputText value="#{hecho.title}"/> + </p:column> + <p:column filterBy="#{hecho.description}" headerText="Descripción" filterMatchMode="contains" visible="#{!hecho.EstaVerifcado()}"> + <h:outputText value="#{hecho.description}"/> + </p:column> + <p:column filterBy="#{hecho.actualState.value}" headerText="Estados" filterMatchMode="exact" visible="#{!hecho.EstaVerifcado()}"> + <h:outputText value="#{hecho.actualState.value}"/> + </p:column> + + <p:column headerText="" style="text-align: center" visible="#{!hecho.EstaVerifcado()}" > + + <p:growl id="message" showDetail="true" /> + + <p:commandButton value="Publicar" action="#{hecho.PublicarHecho()}" update="@form" > + <p:confirm header="Confirmar" message="¿Confirmar Hecho?" icon="pi pi-exclamation-triangle" /> + </p:commandButton> + <p:commandButton value="Cancelar" action="#{hecho.CancelarHecho()}" update="@form" > + <p:confirm header="Confirmar" message="¿Cancelar Hecho?" icon="pi pi-exclamation-triangle" /> + </p:commandButton> + + <p:confirmDialog global="true" showEffect="fade" hideEffect="fade"> + <p:commandButton value="Si" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" /> + <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" /> + </p:confirmDialog> + + </p:column> + </p:dataTable> + + </h:form> + + + + </ui:define> +</ui:decorate> +</html> diff --git a/central-dto/src/main/java/uy/edu/fing/tse/dto/Fact.java b/central-dto/src/main/java/uy/edu/fing/tse/dto/Fact.java index ceed9b04f8edef764026750afcc542ce37ea9255..d2eed684121e5203f0ec462a02152a3a050577cf 100644 --- a/central-dto/src/main/java/uy/edu/fing/tse/dto/Fact.java +++ b/central-dto/src/main/java/uy/edu/fing/tse/dto/Fact.java @@ -79,4 +79,20 @@ public final class Fact implements Serializable { public void addHistory(StateHistory history) { this.history.add(history); } + + public void setEstado() { + this.actualState.setValue("A Comprobar"); + } + + public Boolean EstaVerifcado() { + return (actualState.getValue().equals("En Proceso") || actualState.getValue().equals("Verificado") || (actualState.getValue().equals("A Comprobar"))); + + } + + public void CancelarHecho() { + this.actualState.setValue("Cancelar"); + } + public void PublicarHecho() { + this.actualState.setValue("Publicado"); + } }