|
|
|
@ -2,6 +2,7 @@ package mx.gob.jumapacelaya.views; |
|
|
|
|
|
|
|
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.grid.Grid; |
|
|
|
import com.vaadin.flow.component.html.*; |
|
|
|
import com.vaadin.flow.component.icon.Icon; |
|
|
|
@ -16,6 +17,7 @@ import com.vaadin.flow.component.textfield.NumberField; |
|
|
|
import com.vaadin.flow.router.PageTitle; |
|
|
|
import com.vaadin.flow.router.Route; |
|
|
|
import com.vaadin.flow.theme.lumo.LumoUtility; |
|
|
|
import de.f0rce.signaturepad.SignaturePad; |
|
|
|
import mx.gob.jumapacelaya.Services.GuardarSolicitudService; |
|
|
|
import mx.gob.jumapacelaya.Services.PredioService; |
|
|
|
import mx.gob.jumapacelaya.models.Predio; |
|
|
|
@ -37,6 +39,16 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
private Predio predio; |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(CuestionarioView.class); |
|
|
|
private String vEstado="S"; |
|
|
|
private SignaturePad vFirmaCuest; |
|
|
|
private RadioButtonGroup<Integer> opcionesIng = new RadioButtonGroup<>(); |
|
|
|
private RadioButtonGroup<Integer> opcionesEnf = new RadioButtonGroup<>(); |
|
|
|
private RadioButtonGroup<Integer> opcionesDepen= new RadioButtonGroup<>(); |
|
|
|
private RadioButtonGroup<Integer> opcionesSalud= new RadioButtonGroup<>(); |
|
|
|
private RadioButtonGroup<Integer> opcionesZona= new RadioButtonGroup<>(); |
|
|
|
private RadioButtonGroup<Integer> opcionesEscolar= new RadioButtonGroup<>(); |
|
|
|
private RadioButtonGroup<Integer> opcionesEdad= new RadioButtonGroup<>(); |
|
|
|
private Button btnGuardar = new Button(); |
|
|
|
|
|
|
|
|
|
|
|
public CuestionarioView(PredioService predioService, GuardarSolicitudService guardarSolicitudService) { |
|
|
|
this.setSizeFull(); |
|
|
|
@ -44,6 +56,15 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
this.guardarSolicitudService = guardarSolicitudService; |
|
|
|
this.predioService = predioService; |
|
|
|
|
|
|
|
vFirmaCuest = new SignaturePad(); |
|
|
|
vFirmaCuest.setBackgroundColor("#FFFFFF"); |
|
|
|
vFirmaCuest.setHeight("200px"); |
|
|
|
vFirmaCuest.setPenColor("int red"); |
|
|
|
vFirmaCuest.getElement().getStyle().set("border", "1px solid black"); |
|
|
|
vFirmaCuest.setVisible(false); |
|
|
|
vFirmaCuest.setReadOnly(false); |
|
|
|
vFirmaCuest.getStyle().remove("pointer-events"); |
|
|
|
|
|
|
|
cabecera(); |
|
|
|
titulo(); |
|
|
|
form(); |
|
|
|
@ -90,6 +111,16 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
this.add(tituloLayout); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean allRadioButtonsSelected() { |
|
|
|
return opcionesIng.getValue() != null && |
|
|
|
opcionesEnf.getValue() != null && |
|
|
|
opcionesDepen.getValue() != null && |
|
|
|
opcionesSalud.getValue() != null && |
|
|
|
opcionesZona.getValue() != null && |
|
|
|
opcionesEscolar.getValue() != null && |
|
|
|
opcionesEdad.getValue() != null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void form() { |
|
|
|
// Contenedor principal |
|
|
|
@ -253,37 +284,30 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
|
|
|
|
/* Columnas puntos */ |
|
|
|
// Columna puntos Ingresos |
|
|
|
RadioButtonGroup<Integer> opcionesIng = new RadioButtonGroup<>(); |
|
|
|
opcionesIng.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesIng.setItems(0, 5, 10, 15); |
|
|
|
|
|
|
|
// Columna puntos enfermedades |
|
|
|
RadioButtonGroup<Integer> opcionesEnf = new RadioButtonGroup<>(); |
|
|
|
opcionesEnf.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesEnf.setItems(0, 5, 10); |
|
|
|
|
|
|
|
// Columna puntos dependientes |
|
|
|
RadioButtonGroup<Integer> opcionesDepen= new RadioButtonGroup<>(); |
|
|
|
opcionesDepen.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesDepen.setItems(0, 5, 10, 15); |
|
|
|
|
|
|
|
// Columna puntos salud |
|
|
|
RadioButtonGroup<Integer> opcionesSalud= new RadioButtonGroup<>(); |
|
|
|
opcionesSalud.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesSalud.setItems(3, 5, 7, 10); |
|
|
|
|
|
|
|
// Columna puntos zona habitacional |
|
|
|
RadioButtonGroup<Integer> opcionesZona= new RadioButtonGroup<>(); |
|
|
|
opcionesZona.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesZona.setItems(0, 5, 10, 15); |
|
|
|
|
|
|
|
// Columna puntos grado escolar |
|
|
|
RadioButtonGroup<Integer> opcionesEscolar= new RadioButtonGroup<>(); |
|
|
|
opcionesEscolar.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesEscolar.setItems(0, 5, 10, 15); |
|
|
|
|
|
|
|
// Columna puntos edad |
|
|
|
RadioButtonGroup<Integer> opcionesEdad= new RadioButtonGroup<>(); |
|
|
|
opcionesEdad.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); |
|
|
|
opcionesEdad.setItems(0, 4, 7, 10); |
|
|
|
|
|
|
|
@ -368,6 +392,15 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
opcionesZona.addValueChangeListener(event -> sumarPuntos.run()); |
|
|
|
|
|
|
|
|
|
|
|
opcionesIng.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
opcionesDepen.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
opcionesEdad.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
opcionesEnf.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
opcionesSalud.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
opcionesEscolar.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
opcionesZona.addValueChangeListener(event -> actualizarVisibilidad.run()); |
|
|
|
|
|
|
|
|
|
|
|
// Recuperar los datos de la sesión |
|
|
|
this.predio = (Predio) UI.getCurrent().getSession().getAttribute("predio"); |
|
|
|
String tipoSolicitud = (String) UI.getCurrent().getSession().getAttribute("tipoSolicitud"); |
|
|
|
@ -386,7 +419,7 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
logger.info("Predio: "+this.predio+" con tipo de solicitud: ["+tipoSolicitud+"] y nombre de Solicitante: "+ nombreSolicitante); |
|
|
|
|
|
|
|
// Boton para guardar la solicitud |
|
|
|
Button btnGuardar = new Button("Guardar", event -> { |
|
|
|
btnGuardar = new Button("Guardar", event -> { |
|
|
|
Boolean vGuardado=false; |
|
|
|
String vDetDesc=""; |
|
|
|
String vDetCalif=""; |
|
|
|
@ -420,10 +453,16 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
btnGuardar.addThemeVariants(ButtonVariant.LUMO_PRIMARY); |
|
|
|
btnGuardar.setVisible(false); |
|
|
|
|
|
|
|
|
|
|
|
VerticalLayout botonLayout = new VerticalLayout(btnGuardar); |
|
|
|
|
|
|
|
VerticalLayout botonLayout = new VerticalLayout(); |
|
|
|
botonLayout.setAlignItems(Alignment.END); |
|
|
|
botonLayout.setWidthFull(); |
|
|
|
botonLayout.setHeightFull(); |
|
|
|
botonLayout.add(btnGuardar, vFirmaCuest); |
|
|
|
VerticalLayout totalesLayout = new VerticalLayout(puntos, descuento, txtAgua, txtDrena, txtTrata); |
|
|
|
|
|
|
|
|
|
|
|
@ -448,6 +487,12 @@ public class CuestionarioView extends VerticalLayout { |
|
|
|
this.add(formLayout); |
|
|
|
} |
|
|
|
|
|
|
|
Runnable actualizarVisibilidad = () -> { |
|
|
|
boolean todosSelccionados = allRadioButtonsSelected(); |
|
|
|
btnGuardar.setVisible(todosSelccionados); |
|
|
|
vFirmaCuest.setVisible(todosSelccionados); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private void notificacion(String message) { |
|
|
|
Notification notification = new Notification(); |
|
|
|
|