|
|
@ -6,6 +6,8 @@ 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.Span; |
|
|
|
import com.vaadin.flow.component.icon.Icon; |
|
|
|
import com.vaadin.flow.component.icon.VaadinIcon; |
|
|
|
import com.vaadin.flow.component.orderedlayout.FlexComponent; |
|
|
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; |
|
|
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout; |
|
|
@ -68,9 +70,10 @@ public class MisTicketsView extends VerticalLayout { |
|
|
|
grid.addColumn(ticket -> ticket.tiempoEst(ticket.getTrackerId())).setHeader("Tiempo estimado de atencion").setAutoWidth(false); |
|
|
|
|
|
|
|
grid.addComponentColumn(ticket -> { |
|
|
|
Button btnVer = new Button("Ver"); |
|
|
|
Button btnVer = new Button("Ver", new Icon(VaadinIcon.EYE)); |
|
|
|
btnVer.setTooltipText("Ver descripción"); |
|
|
|
btnVer.addClickListener(event -> showDescription(ticket)); |
|
|
|
btnVer.getStyle().set("color", "#691b31"); |
|
|
|
btnVer.getStyle().set("color", "#A02142"); |
|
|
|
return btnVer; |
|
|
|
}).setHeader("Descripcion").setAutoWidth(true); |
|
|
|
|
|
|
@ -102,11 +105,14 @@ public class MisTicketsView extends VerticalLayout { |
|
|
|
textEditor.setValue(ticket.getDescription()); |
|
|
|
textEditor.setReadOnly(true); |
|
|
|
|
|
|
|
Button verNotas = new Button("Comentarios"); |
|
|
|
verNotas.addClickListener(event -> showComents(ticket)); |
|
|
|
|
|
|
|
Button closeButton = new Button("Cerrar"); |
|
|
|
closeButton.addThemeVariants(ButtonVariant.LUMO_ERROR); |
|
|
|
closeButton.addClickListener(e -> dialog.close()); |
|
|
|
|
|
|
|
HorizontalLayout buttonLayout = new HorizontalLayout(closeButton); |
|
|
|
HorizontalLayout buttonLayout = new HorizontalLayout(verNotas, closeButton); |
|
|
|
buttonLayout.setWidthFull(); |
|
|
|
buttonLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); |
|
|
|
buttonLayout.add(closeButton); |
|
|
@ -116,6 +122,39 @@ public class MisTicketsView extends VerticalLayout { |
|
|
|
dialog.open(); |
|
|
|
} |
|
|
|
|
|
|
|
private void showComents(Ticket ticket) { |
|
|
|
Dialog comentDialog = new Dialog(); |
|
|
|
comentDialog.getElement().setAttribute("arial-label", "Comentarios del ticket"); |
|
|
|
comentDialog.setMaxHeight("500px"); |
|
|
|
comentDialog.setMaxWidth("1100px"); |
|
|
|
|
|
|
|
VerticalLayout layout = new VerticalLayout(); |
|
|
|
layout.setPadding(true); |
|
|
|
layout.setSpacing(true); |
|
|
|
|
|
|
|
// Obtenemos los comentarios desde Proyman |
|
|
|
List<String> comentarios = redmineClient.getTicketComments(ticket.getId(), userService.getRedmineUser()); |
|
|
|
|
|
|
|
if (comentarios != null && !comentarios.isEmpty()) { |
|
|
|
for (String comentario : comentarios) { |
|
|
|
Span commentSpan = new Span(comentario); |
|
|
|
commentSpan.getElement().getStyle().set("background", "#f1f1f1"); |
|
|
|
commentSpan.getElement().getStyle().set("padding", "10px"); |
|
|
|
commentSpan.getElement().getStyle().set("border-radius", "5px"); |
|
|
|
layout.add(commentSpan); |
|
|
|
} |
|
|
|
} else { |
|
|
|
layout.add(new Span("No hay comentarios para este ticket.")); |
|
|
|
} |
|
|
|
|
|
|
|
Button closeButton = new Button("Cerrar", event -> comentDialog.close()); |
|
|
|
closeButton.addThemeVariants(ButtonVariant.LUMO_ERROR); |
|
|
|
|
|
|
|
layout.add(closeButton); |
|
|
|
comentDialog.add(layout); |
|
|
|
comentDialog.open(); |
|
|
|
} |
|
|
|
|
|
|
|
private void loadTickets() { |
|
|
|
try { |
|
|
|
List<Ticket> tickets = redmineClient.getTicketsAuthor(userService.getRedmineUser()); |
|
|
@ -132,13 +171,22 @@ public class MisTicketsView extends VerticalLayout { |
|
|
|
Span span = new Span(ticket.getStatus()); |
|
|
|
switch (ticket.getStatus().toLowerCase()) { |
|
|
|
case "análisis": |
|
|
|
span.getElement().getStyle().set("color","purple"); |
|
|
|
span.getElement().getStyle().set("color","orange"); |
|
|
|
break; |
|
|
|
case "desarrollo": |
|
|
|
span.getElement().getStyle().set("color","green"); |
|
|
|
span.getElement().getStyle().set("color","blue"); |
|
|
|
break; |
|
|
|
case "rechazada": |
|
|
|
span.getElement().getStyle().set("color","red"); |
|
|
|
break; |
|
|
|
case "cerrada": |
|
|
|
span.getElement().getStyle().set("color","grey"); |
|
|
|
break; |
|
|
|
case "solicitado": |
|
|
|
span.getElement().getStyle().set("color","purple"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
span.getElement().getStyle().set("color","blue"); |
|
|
|
span.getElement().getStyle().set("color","green"); |
|
|
|
break; |
|
|
|
} |
|
|
|
return span; |
|
|
|