|
|
@ -69,6 +69,7 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
private GridPro<HardwareDetalle> gridHardware; |
|
|
|
private GridPro<ActualizacioneSeguridadModel> gridActualizaciones; |
|
|
|
private Button btnEditar; |
|
|
|
private Button btnEditarFirmas; |
|
|
|
private Button btnImprimirRepo; |
|
|
|
private Button btnCancelar; |
|
|
|
private Button btnGuardar; |
|
|
@ -199,9 +200,10 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
botonesLayout.setJustifyContentMode(JustifyContentMode.CENTER); |
|
|
|
btnEditar = new Button("Editar", new Icon(VaadinIcon.EDIT)); |
|
|
|
btnImprimirRepo = new Button("Imprimir Reporte", new Icon(VaadinIcon.PRINT)); |
|
|
|
btnEditarFirmas = new Button("Editar firmas", LineAwesomeIcon.SIGNATURE_SOLID.create()); |
|
|
|
btnGuardar = new Button("Guardar", LineAwesomeIcon.SAVE_SOLID.create()); |
|
|
|
btnCancelar = new Button("Cancelar", new Icon(VaadinIcon.CLOSE_CIRCLE_O)); |
|
|
|
botonesLayout.add(btnEditar,btnImprimirRepo,btnGuardar,btnCancelar); |
|
|
|
botonesLayout.add(btnEditar,btnEditarFirmas,btnImprimirRepo,btnGuardar,btnCancelar); |
|
|
|
|
|
|
|
btnGuardar.setVisible(false); |
|
|
|
btnGuardar.getStyle().set("background-color", "#008000"); |
|
|
@ -221,10 +223,25 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
btnEditar.setVisible(false); |
|
|
|
btnGuardar.setVisible(true); |
|
|
|
btnCancelar.setVisible(true); |
|
|
|
btnEditarFirmas.setVisible(false); |
|
|
|
gridHardware.setEditOnClick(true); |
|
|
|
gridActualizaciones.setEditOnClick(true); |
|
|
|
}); |
|
|
|
|
|
|
|
btnEditarFirmas.addClickListener(e -> { |
|
|
|
btnCancelar.setVisible(true); |
|
|
|
btnGuardar.setVisible(true); |
|
|
|
btnEditar.setVisible(false); |
|
|
|
btnImprimirRepo.setVisible(false); |
|
|
|
btnEditarFirmas.setVisible(false); |
|
|
|
if (firmaUsuarioImg != null && firmaUsuarioImg.getParent().isPresent()) { |
|
|
|
userSignLayout.replace(firmaUsuarioImg, userSignPad); |
|
|
|
} |
|
|
|
if (firmaSmtImg != null && firmaSmtImg.getParent().isPresent()) { |
|
|
|
smtSignLayout.replace(firmaSmtImg, smtSignPad); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
btnCancelar.addClickListener(e -> { |
|
|
|
txtEquipo.setReadOnly(true); |
|
|
|
cbTipo.setReadOnly(true); |
|
|
@ -236,6 +253,7 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
btnEditar.setVisible(true); |
|
|
|
btnGuardar.setVisible(false); |
|
|
|
btnCancelar.setVisible(false); |
|
|
|
btnEditarFirmas.setVisible(true); |
|
|
|
gridHardware.setEditOnClick(false); |
|
|
|
gridHardware.getEditor().cancel(); |
|
|
|
gridActualizaciones.setEditOnClick(false); |
|
|
@ -341,7 +359,22 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
LocalDate fechaRealizado = !txtFecha.getValue().isEmpty() ? LocalDate.parse(txtFecha.getValue(), formatter) : null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Obtener las firmas como en MantenimientoView |
|
|
|
byte[] userSignatureBytes = userSignPad.getImageBase64(); |
|
|
|
byte[] smtSignatureBytes = smtSignPad.getImageBase64(); |
|
|
|
|
|
|
|
String userSignatureBase64 = (userSignatureBytes != null) ? Base64.getEncoder().encodeToString(userSignatureBytes) : null; |
|
|
|
String smtSignatureBase64 = (smtSignatureBytes != null) ? Base64.getEncoder().encodeToString(smtSignatureBytes) : null; |
|
|
|
|
|
|
|
// Si la firma está vacía, conserva la anterior |
|
|
|
if (userSignatureBase64 == null || esFirmaVacia(userSignatureBase64)) { |
|
|
|
userSignatureBase64 = service.getDetalleMantenimientoPorPlanAnualId(planAnualIdActual).getFirmaUser(); |
|
|
|
} |
|
|
|
if (smtSignatureBase64 == null || esFirmaVacia(smtSignatureBase64)) { |
|
|
|
smtSignatureBase64 = service.getDetalleMantenimientoPorPlanAnualId(planAnualIdActual).getFirmaSmt(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ACTUALIZA PLANANUAL (nombre del equipo y fecha programada) |
|
|
|
if (!service.actualizarPlanAnual(planAnualIdActual, txtEquipo.getValue(), fechaProg)) { |
|
|
@ -354,7 +387,9 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
departamentoId, |
|
|
|
empleadoId, |
|
|
|
fechaRealizado, |
|
|
|
txtEquipo.getValue() |
|
|
|
txtEquipo.getValue(), |
|
|
|
userSignatureBase64, |
|
|
|
smtSignatureBase64 |
|
|
|
)) { |
|
|
|
exito = false; |
|
|
|
} |
|
|
@ -389,6 +424,7 @@ public class DetallesMantView extends VerticalLayout implements BeforeEnterObser |
|
|
|
cbDepartamento.setReadOnly(true); |
|
|
|
btnImprimirRepo.setVisible(true); |
|
|
|
btnEditar.setVisible(true); |
|
|
|
btnEditarFirmas.setVisible(true); |
|
|
|
btnGuardar.setVisible(false); |
|
|
|
btnCancelar.setVisible(false); |
|
|
|
gridHardware.setEditOnClick(false); |
|
|
|