|
|
@ -2,15 +2,19 @@ package mx.gob.jumapacelaya.ui; |
|
|
|
|
|
|
|
import com.vaadin.flow.component.UI; |
|
|
|
import com.vaadin.flow.component.button.Button; |
|
|
|
import com.vaadin.flow.component.button.ButtonVariant; |
|
|
|
import com.vaadin.flow.component.dependency.CssImport; |
|
|
|
import com.vaadin.flow.component.dialog.Dialog; |
|
|
|
import com.vaadin.flow.component.grid.Grid; |
|
|
|
import com.vaadin.flow.component.grid.GridVariant; |
|
|
|
import com.vaadin.flow.component.html.H3; |
|
|
|
import com.vaadin.flow.component.html.Span; |
|
|
|
import com.vaadin.flow.component.notification.Notification; |
|
|
|
import com.vaadin.flow.component.notification.NotificationVariant; |
|
|
|
import com.vaadin.flow.component.orderedlayout.FlexComponent; |
|
|
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; |
|
|
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout; |
|
|
|
import com.vaadin.flow.component.richtexteditor.RichTextEditor; |
|
|
|
import com.vaadin.flow.data.renderer.ComponentRenderer; |
|
|
|
import com.vaadin.flow.router.PageTitle; |
|
|
|
import com.vaadin.flow.router.Route; |
|
|
@ -56,7 +60,7 @@ public class ActDiariaView extends VerticalLayout { |
|
|
|
.setAutoWidth(true); |
|
|
|
|
|
|
|
grid.addColumn(Ticket::getSubject).setHeader("Asunto") |
|
|
|
.setAutoWidth(true); |
|
|
|
.setWidth("25em"); |
|
|
|
|
|
|
|
grid.addColumn(createStatusRender()).setHeader("Estado"); |
|
|
|
|
|
|
@ -80,15 +84,20 @@ public class ActDiariaView extends VerticalLayout { |
|
|
|
} |
|
|
|
}).setHeader("Fecha cierre").setAutoWidth(true); |
|
|
|
|
|
|
|
grid.addColumn(ticket -> ticket.tiempoEst(ticket.getTrackerId())).setHeader("Tiempo estimado de atencion").setAutoWidth(false); |
|
|
|
//grid.addColumn(ticket -> ticket.tiempoEst(ticket.getTrackerId())).setHeader("Tiempo estimado de atencion").setAutoWidth(false); |
|
|
|
|
|
|
|
grid.addColumn(Ticket::getDescription).setHeader("Descripción").setWidth("25em"); |
|
|
|
grid.addComponentColumn(ticket -> { |
|
|
|
Button btnVer = new Button("Ver"); |
|
|
|
btnVer.addClickListener(event -> showDescription(ticket)); |
|
|
|
return btnVer; |
|
|
|
}).setHeader("Descripcion").setAutoWidth(true); |
|
|
|
|
|
|
|
grid.addColumn(buttonTicketComponentRenderer()).setHeader("Realizar").setFlexGrow(0).setAutoWidth(true); |
|
|
|
|
|
|
|
grid.addThemeVariants(GridVariant.LUMO_WRAP_CELL_CONTENT); |
|
|
|
grid.getStyle().set("opacity", "0.8"); |
|
|
|
grid.setAllRowsVisible(true); |
|
|
|
grid.setAllRowsVisible(false); |
|
|
|
grid.setHeight("35em"); |
|
|
|
|
|
|
|
// Ajustar tamaño del Grid y Layout |
|
|
|
//grid.setSizeFull(); |
|
|
@ -104,7 +113,7 @@ public class ActDiariaView extends VerticalLayout { |
|
|
|
|
|
|
|
private void loadTickets() { |
|
|
|
try { |
|
|
|
List<Ticket> tickets = redmineClient.getTicketsAuthor(userService.getRedmineUser(), true); |
|
|
|
List<Ticket> tickets = redmineClient.getTickets(userService.getRedmineUser(), true); |
|
|
|
List<Ticket> filteredTickets = tickets.stream() |
|
|
|
.filter(ticket -> ticket.getTrackerId() == 17 || ticket.getTrackerId() == 16) |
|
|
|
.toList(); |
|
|
@ -166,4 +175,30 @@ public class ActDiariaView extends VerticalLayout { |
|
|
|
Notification.show("Error al cerrar el ticket " + ticket.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Metodo para mostrar las descripciones en un componente Dialog |
|
|
|
private void showDescription(Ticket ticket) { |
|
|
|
|
|
|
|
Dialog dialog = new Dialog(); |
|
|
|
dialog.getElement().setAttribute("arial-label", "Add note"); |
|
|
|
dialog.setMaxHeight("500px"); |
|
|
|
dialog.setMaxWidth("1100px"); |
|
|
|
|
|
|
|
RichTextEditor textEditor = new RichTextEditor(); |
|
|
|
textEditor.setValue(ticket.getDescription()); |
|
|
|
textEditor.setReadOnly(true); |
|
|
|
|
|
|
|
Button closeButton = new Button("Cerrar"); |
|
|
|
closeButton.addThemeVariants(ButtonVariant.LUMO_ERROR); |
|
|
|
closeButton.addClickListener(e -> dialog.close()); |
|
|
|
|
|
|
|
HorizontalLayout buttonLayout = new HorizontalLayout(closeButton); |
|
|
|
buttonLayout.setWidthFull(); |
|
|
|
buttonLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); |
|
|
|
buttonLayout.add(closeButton); |
|
|
|
|
|
|
|
dialog.add(textEditor, buttonLayout); |
|
|
|
|
|
|
|
dialog.open(); |
|
|
|
} |
|
|
|
} |