|
|
|
@ -10,6 +10,7 @@ import com.vaadin.flow.component.notification.NotificationVariant; |
|
|
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; |
|
|
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout; |
|
|
|
import com.vaadin.flow.component.radiobutton.RadioButtonGroup; |
|
|
|
import com.vaadin.flow.component.textfield.TextArea; |
|
|
|
import com.vaadin.flow.component.textfield.TextField; |
|
|
|
import com.vaadin.flow.router.BeforeEnterEvent; |
|
|
|
import com.vaadin.flow.router.BeforeEnterObserver; |
|
|
|
@ -32,11 +33,10 @@ public class EncuestaView extends VerticalLayout implements BeforeEnterObserver |
|
|
|
private final DatabaseService encuestasDBService; |
|
|
|
private int mantenimientoId = -1; |
|
|
|
private final VerticalLayout mainLyt = new VerticalLayout(); |
|
|
|
private final Span pregunta1Txt = new Span(); |
|
|
|
private final RadioButtonGroup<String> pregunta1Rb = new RadioButtonGroup<>(); |
|
|
|
private final Button btnEnviar = new Button("Enviar"); |
|
|
|
private final TextField txtNumEmpl = new TextField("No. Empleado:"); |
|
|
|
private String token; |
|
|
|
private final TextArea txtComentarios = new TextArea("Comentarios:"); |
|
|
|
|
|
|
|
|
|
|
|
private static class RespuestaComponente { |
|
|
|
@ -56,7 +56,6 @@ public class EncuestaView extends VerticalLayout implements BeforeEnterObserver |
|
|
|
|
|
|
|
setSpacing(true); |
|
|
|
setPadding(true); |
|
|
|
setSizeFull(); |
|
|
|
|
|
|
|
this.getStyle() |
|
|
|
.set("background-image", "url('/images/LOGO_1024X768.jpg')") |
|
|
|
@ -65,9 +64,11 @@ public class EncuestaView extends VerticalLayout implements BeforeEnterObserver |
|
|
|
.set("background-position", "center"); |
|
|
|
|
|
|
|
|
|
|
|
mainLyt.setHeightFull(); |
|
|
|
|
|
|
|
mainLyt.setWidth("55%"); |
|
|
|
//mainLyt.setMaxHeight("90vh"); |
|
|
|
mainLyt.getStyle() |
|
|
|
.set("overflow-y", "auto") |
|
|
|
.set("box-shadow", "0 4px 8px rgba(0,0,0,0.2)") |
|
|
|
.set("border-radius", "12px") |
|
|
|
.set("background-color", "white") |
|
|
|
@ -119,6 +120,10 @@ public class EncuestaView extends VerticalLayout implements BeforeEnterObserver |
|
|
|
respuestasUI.add(new RespuestaComponente(p,radios)); |
|
|
|
} |
|
|
|
|
|
|
|
txtComentarios.setWidthFull(); |
|
|
|
txtComentarios.setMaxHeight("5rem"); |
|
|
|
preguntasLyt.add(txtComentarios); |
|
|
|
|
|
|
|
HorizontalLayout gracias = new HorizontalLayout(new H3("¡Gracias!")); |
|
|
|
gracias.setWidthFull(); |
|
|
|
gracias.setJustifyContentMode(JustifyContentMode.CENTER); |
|
|
|
@ -133,7 +138,7 @@ public class EncuestaView extends VerticalLayout implements BeforeEnterObserver |
|
|
|
|
|
|
|
|
|
|
|
mainLyt.removeAll(); |
|
|
|
mainLyt.add(titulos,preguntasLyt,gracias, btnEnviarLyt); |
|
|
|
mainLyt.add(titulos,preguntasLyt ,gracias, btnEnviarLyt); |
|
|
|
} |
|
|
|
|
|
|
|
private void procesarRespuestas() { |
|
|
|
@ -155,11 +160,15 @@ public class EncuestaView extends VerticalLayout implements BeforeEnterObserver |
|
|
|
rc.radios.getValue().equals("Si") |
|
|
|
)); |
|
|
|
} |
|
|
|
txtComentarios.getValue(); |
|
|
|
String comentarios = txtComentarios.isEmpty() ? null : txtComentarios.getValue(); |
|
|
|
|
|
|
|
|
|
|
|
encuestasDBService.insertRespuestas( |
|
|
|
mantenimientoId, |
|
|
|
respuestas, |
|
|
|
empleadoId, |
|
|
|
comentarios, |
|
|
|
this.token |
|
|
|
); |
|
|
|
|
|
|
|
|