|
|
|
@ -50,10 +50,12 @@ import java.util.UUID;
|
|
|
|
|
@PageTitle("Employee")
|
|
|
|
|
@Route(value = "/employees/:employeeId?/:action?", layout = MainLayout.class)
|
|
|
|
|
public class EmployeeView extends BeanValidationForm<Employee> implements HasUrlParameter<String> {
|
|
|
|
|
|
|
|
|
|
private final EmployeeService employeeService;
|
|
|
|
|
private final ReportService reportService;
|
|
|
|
|
private final TimeOffRequestService requestService;
|
|
|
|
|
private final TeamService teamService;
|
|
|
|
|
|
|
|
|
|
// TODO: campo usado para registrar al empleado en LDAP. Este campo podria estar en otro form eventualmente.
|
|
|
|
|
private final TextField username = createTextField("Username: ", 30, true);
|
|
|
|
|
private final TextField firstName = createTextField("Nombres: ", 30, true);
|
|
|
|
@ -68,20 +70,21 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
private final TextField localAddress = createTextField("Departamento y Provincia de Residencia "
|
|
|
|
|
+ " ejemplo: (Departamento-Provincia)", 30, false);
|
|
|
|
|
private final ComboBox<Employee.MaritalStatus> maritalStatus = createMaritalStatusComboBox();
|
|
|
|
|
private final TextField numberOfChildren = createTextField("Numero de Hijos", 1, false);
|
|
|
|
|
private final TextField numberOfChildren = createTextField("Numero de Hijos", 2, false);
|
|
|
|
|
private final TextField ci = createTextField("CI", 10, false);
|
|
|
|
|
private final TextField issuedIn = createTextField("Expedido en ", 10, false);
|
|
|
|
|
private final TextField phoneNumber = createTextField("Teléfono", 8, false);
|
|
|
|
|
private final EmailField personalEmail = createEmailField("E-mail ejemplo: (ejemplo@gmail.com)");
|
|
|
|
|
private final TextField phoneNumberProfesional = createTextField("Teléfono Laboral", 8, false);
|
|
|
|
|
private final EmailField profesionalEmail = createEmailField("E-mail Laboral ejemplo: (ejemplo@primerfactorsolutions.com)");
|
|
|
|
|
private final TextField emergencyCName = createTextField("Nombres y Apellidos de Contacto", 50, false);
|
|
|
|
|
private final TextField emergencyCAddress = createTextField("Dirección de Contacto", 50, false);
|
|
|
|
|
private final TextField emergencyCPhone = createTextField("Teléfono de Contacto", 8, false);
|
|
|
|
|
private final EmailField emergencyCEmail = createEmailField("Email de Contacto ejemplo: (ejemplo@gmail.com)");
|
|
|
|
|
|
|
|
|
|
private final MemoryBuffer buffer = new MemoryBuffer();
|
|
|
|
|
private final Upload upload = new Upload(buffer);
|
|
|
|
|
private final Image profileImagePreview = new Image();
|
|
|
|
|
|
|
|
|
|
//INFORMACION PROFESIONAL
|
|
|
|
|
private final TextField pTitle1 = createTextField("Título 1", 30, false);
|
|
|
|
|
private final TextField pTitle2 = createTextField("Título 2", 30, false);
|
|
|
|
|
private final TextField pTitle3 = createTextField("Título 3", 30, false);
|
|
|
|
@ -94,46 +97,49 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
private final TextField certification4 = createTextField("Certificación 4", 30, false);
|
|
|
|
|
private final TextField recognition = createTextField("Reconocimientos", 30, false);
|
|
|
|
|
private final TextField achievements = createTextField("Logros Profesionales", 30, false);
|
|
|
|
|
private final TextField language1 = createTextField("Idioma 1", 30, false);
|
|
|
|
|
private final TextField language1Level = createTextField("Nivel de Idioma", 30, false);
|
|
|
|
|
private final TextField language2 = createTextField("Idioma 2", 30, false);
|
|
|
|
|
private final TextField language2Level = createTextField("Nivel de Idioma", 30, false);
|
|
|
|
|
private final TextField language = createTextField("Idioma", 50, false);
|
|
|
|
|
private final TextField languageLevel = createTextField("Nivel de Idioma", 30, false);
|
|
|
|
|
|
|
|
|
|
//INFORMACION ADMINISTRATIVA
|
|
|
|
|
private final TextField cod = createTextField("Codigo de Empleado", 20, false);
|
|
|
|
|
private final TextField position = createTextField("Cargo", 30, false);
|
|
|
|
|
private final ComboBox<Team> team = new ComboBox<>("Equipo");
|
|
|
|
|
private final TextField leadManager = createTextField("Lead/Manager", 30, false);
|
|
|
|
|
private final TextField project = createTextField("Proyecto", 30, false);
|
|
|
|
|
private final VDatePicker dateOfEntry = new VDatePicker("Fecha de Ingreso");
|
|
|
|
|
private final VDatePicker dateOfExit = new VDatePicker("Fecha de Retiro");
|
|
|
|
|
private final ComboBox<Employee.ContractType> contractType = createContractTypeComboBox();
|
|
|
|
|
private final TextField contractType = createTextField("Tipo de Contratación", 30, false);
|
|
|
|
|
private final TextField seniority = createTextField("Antiguedad", 30, false);
|
|
|
|
|
private final TextField salaryTotal = createTextField("Salario Total", 10, false);
|
|
|
|
|
private final TextField salaryBasic = createTextField("Salario Basico", 10, false);
|
|
|
|
|
private final TextField antiguedad = createTextField("Descuento por Antiguedad", 10, false);
|
|
|
|
|
private final TextField bonoProfesional = createTextField("Bono Profesional", 30, false);
|
|
|
|
|
private final TextField salary = createTextField("Salario", 30, false);
|
|
|
|
|
private final TextField bankName = createTextField("Banco", 30, false);
|
|
|
|
|
private final TextField accountNumber = createTextField("Nro. de Cuenta", 30, false);
|
|
|
|
|
private final TextField gpss = createTextField("Código Único de Asegurado (GPSS)", 30, false);
|
|
|
|
|
private final TextField sss = createTextField("Matricula de Asegurado (SSS)", 30, false);
|
|
|
|
|
private final TextField beneficiarie1 = createTextField("Derechohabiente 1", 30, false);
|
|
|
|
|
private final TextField beneficiarie2 = createTextField("Derechohabiente 2", 30, false);
|
|
|
|
|
private final TextField beneficiaries = createTextField("Derechohabientes", 30, false);
|
|
|
|
|
|
|
|
|
|
private static final String SAVE_BUTTON_TEXT = "Save";
|
|
|
|
|
private static final String EDIT_BUTTON_TEXT = "Edit";
|
|
|
|
|
private static final String NOTIFICATION_SAVE_SUCCESS = "Employee saved successfully.";
|
|
|
|
|
private static final String NOTIFICATION_VALIDATE_ERROR = "Please complete the required fields correctly.";
|
|
|
|
|
private static final String PHONE_NUMBER_ERROR_MESSAGE = "El teléfono debe contener solo números.";
|
|
|
|
|
|
|
|
|
|
private final Button saveButton = new Button(SAVE_BUTTON_TEXT, e -> saveEmployee());
|
|
|
|
|
private final Button editButton = new Button(EDIT_BUTTON_TEXT, e -> enableEditMode());
|
|
|
|
|
private final Button reportButton = new Button("Generar Ficha");
|
|
|
|
|
private final Dialog dialog = new Dialog();
|
|
|
|
|
private final PdfViewer pdfViewer = new PdfViewer();
|
|
|
|
|
|
|
|
|
|
//TITULOS PARA INFORMACION PERSONAL
|
|
|
|
|
private final H2 infoPer = new H2("Información Personal");
|
|
|
|
|
private final H3 infoGenr = new H3("Información General");
|
|
|
|
|
private final H3 contEmerg = new H3("Contacto de Emergencia");
|
|
|
|
|
//TITULOS PARA INFORMACIÓN PROFESIONAL
|
|
|
|
|
private final H2 infProf = new H2("Información Profesional");
|
|
|
|
|
private final H3 titulos = new H3("Titulos Profesionales y Estudios Realizados");
|
|
|
|
|
private final H3 certif = new H3("Certificaciones Profesionales");
|
|
|
|
|
private final H3 logros = new H3("Otros Logros y Reconocimientos");
|
|
|
|
|
private final H3 idioma = new H3("Dominio de Idiomas");
|
|
|
|
|
//TITULOS PARA INFORMACIÓN ADMINISTRATIVA
|
|
|
|
|
private final H2 infoAdm = new H2("Información Administrativa");
|
|
|
|
|
private final H3 infoCont = new H3("Información de Contratación");
|
|
|
|
|
private final H3 datBanc = new H3("Datos Bancarios");
|
|
|
|
@ -149,44 +155,32 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
this.requestService = requestService;
|
|
|
|
|
this.teamService = teamService;
|
|
|
|
|
saveButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
|
|
|
|
|
|
|
|
|
configureComponents();
|
|
|
|
|
addClassName("main-layout");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void makeUpperCase(final TextField textField) {
|
|
|
|
|
textField.addValueChangeListener(event -> {
|
|
|
|
|
String value = event.getValue();
|
|
|
|
|
if (value != null) {
|
|
|
|
|
textField.setValue(value.toUpperCase());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void configureComponents() {
|
|
|
|
|
phoneNumber.setValueChangeMode(ValueChangeMode.EAGER);
|
|
|
|
|
phoneNumber.addValueChangeListener(e -> validatePhoneNumber(phoneNumber, e.getValue()));
|
|
|
|
|
emergencyCPhone.setValueChangeMode(ValueChangeMode.EAGER);
|
|
|
|
|
emergencyCPhone.addValueChangeListener(e -> validatePhoneNumber(emergencyCPhone, e.getValue()));
|
|
|
|
|
|
|
|
|
|
firstName.setValueChangeMode(ValueChangeMode.EAGER);
|
|
|
|
|
firstName.addValueChangeListener(e -> validateNameField(firstName, e.getValue()));
|
|
|
|
|
lastName.setValueChangeMode(ValueChangeMode.EAGER);
|
|
|
|
|
lastName.addValueChangeListener(e -> validateNameField(lastName, e.getValue()));
|
|
|
|
|
createTeamComboBox();
|
|
|
|
|
|
|
|
|
|
configureUpload();
|
|
|
|
|
saveButton.setVisible(true);
|
|
|
|
|
editButton.setVisible(true);
|
|
|
|
|
reportButton.setVisible(true);
|
|
|
|
|
birthday.addValueChangeListener(event -> calculateAge());
|
|
|
|
|
birthday.setMax(java.time.LocalDate.now().minusYears(18));
|
|
|
|
|
salaryTotal.addValueChangeListener(event -> calculateSalaryTotal());
|
|
|
|
|
birthday.setMax(java.time.LocalDate.now());
|
|
|
|
|
dateOfEntry.addValueChangeListener(event -> calculateSeniority());
|
|
|
|
|
dateOfExit.addValueChangeListener(event -> {
|
|
|
|
|
if(event.getValue() != null){
|
|
|
|
|
status.setValue(Employee.Status.INACTIVE);
|
|
|
|
|
} else {
|
|
|
|
|
status.setValue(Employee.Status.ACTIVE);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dateOfEntry.addValueChangeListener(event -> calculateSeniority());
|
|
|
|
|
|
|
|
|
|
reportButton.addClickListener((ComponentEventListener<ClickEvent<Button>>) buttonClickEvent -> {
|
|
|
|
|
var employee = getEntity();
|
|
|
|
|
byte[] pdfContent = reportService.writeAsPdf("ficha", employee);
|
|
|
|
@ -195,41 +189,6 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
dialog.open();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
makeUpperCase(firstName);
|
|
|
|
|
makeUpperCase(lastName);
|
|
|
|
|
makeUpperCase(birthCity);
|
|
|
|
|
makeUpperCase(residenceAddress);
|
|
|
|
|
makeUpperCase(localAddress);
|
|
|
|
|
makeUpperCase(position);
|
|
|
|
|
makeUpperCase(emergencyCName);
|
|
|
|
|
makeUpperCase(emergencyCAddress);
|
|
|
|
|
makeUpperCase(ci);
|
|
|
|
|
makeUpperCase(issuedIn);
|
|
|
|
|
makeUpperCase(pTitle1);
|
|
|
|
|
makeUpperCase(pTitle2);
|
|
|
|
|
makeUpperCase(pTitle3);
|
|
|
|
|
makeUpperCase(pStudy1);
|
|
|
|
|
makeUpperCase(pStudy2);
|
|
|
|
|
makeUpperCase(pStudy3);
|
|
|
|
|
makeUpperCase(certification1);
|
|
|
|
|
makeUpperCase(certification2);
|
|
|
|
|
makeUpperCase(certification3);
|
|
|
|
|
makeUpperCase(certification4);
|
|
|
|
|
makeUpperCase(recognition);
|
|
|
|
|
makeUpperCase(achievements);
|
|
|
|
|
makeUpperCase(language1);
|
|
|
|
|
makeUpperCase(language1Level);
|
|
|
|
|
makeUpperCase(language2);
|
|
|
|
|
makeUpperCase(language2Level);
|
|
|
|
|
makeUpperCase(cod);
|
|
|
|
|
makeUpperCase(leadManager);
|
|
|
|
|
makeUpperCase(seniority);
|
|
|
|
|
makeUpperCase(bankName);
|
|
|
|
|
makeUpperCase(accountNumber);
|
|
|
|
|
makeUpperCase(gpss);
|
|
|
|
|
makeUpperCase(sss);
|
|
|
|
|
makeUpperCase(beneficiarie1);
|
|
|
|
|
makeUpperCase(beneficiarie2);
|
|
|
|
|
initDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -248,7 +207,13 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
int birthYear = birthday.getValue().getYear();
|
|
|
|
|
int ages = currentYear - birthYear;
|
|
|
|
|
age.setValue(String.valueOf(ages));
|
|
|
|
|
birthday.setInvalid(ages < 18);
|
|
|
|
|
if (ages < 18) {
|
|
|
|
|
birthday.setInvalid(true);
|
|
|
|
|
birthday.setErrorMessage("La edad no puede ser menor a 18 años.");
|
|
|
|
|
Notification.show("La edad ingresada no es válida, debe ser mayor o igual a 18 años.");
|
|
|
|
|
} else {
|
|
|
|
|
birthday.setInvalid(false);
|
|
|
|
|
}
|
|
|
|
|
System.out.println(age);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -256,6 +221,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
private void calculateSeniority() {
|
|
|
|
|
LocalDate entryDate = dateOfEntry.getValue();
|
|
|
|
|
LocalDate exitDate = dateOfExit.getValue() != null ? dateOfExit.getValue() : LocalDate.now();
|
|
|
|
|
|
|
|
|
|
if (entryDate != null) {
|
|
|
|
|
long yearsOfService = ChronoUnit.YEARS.between(entryDate, exitDate);
|
|
|
|
|
String seniorityValue = yearsOfService + " años ";
|
|
|
|
@ -265,44 +231,6 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void calculateSalaryTotal() {
|
|
|
|
|
if (contractType.getValue() == Employee.ContractType.CONTRATO_LABORAL) {
|
|
|
|
|
salaryBasic.setVisible(true);
|
|
|
|
|
bonoProfesional.setVisible(true);
|
|
|
|
|
antiguedad.setVisible(true);
|
|
|
|
|
salaryTotal.setVisible(true);
|
|
|
|
|
salaryBasic.addValueChangeListener(event -> updateTotalSalary());
|
|
|
|
|
bonoProfesional.addValueChangeListener(event -> updateTotalSalary());
|
|
|
|
|
antiguedad.addValueChangeListener(event -> updateTotalSalary());
|
|
|
|
|
} else {
|
|
|
|
|
salaryBasic.setVisible(false);
|
|
|
|
|
bonoProfesional.setVisible(false);
|
|
|
|
|
antiguedad.setVisible(false);
|
|
|
|
|
salaryTotal.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
salaryTotal.getValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateTotalSalary() {
|
|
|
|
|
try {
|
|
|
|
|
double basic = parseDoubleValue(salaryBasic.getValue());
|
|
|
|
|
double bonus = parseDoubleValue(bonoProfesional.getValue());
|
|
|
|
|
double seniorityBonus = parseDoubleValue(antiguedad.getValue());
|
|
|
|
|
double totalSalary = basic + bonus + seniorityBonus;
|
|
|
|
|
salaryTotal.setValue(String.valueOf(totalSalary));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
salaryTotal.setValue("0.0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double parseDoubleValue(String value) {
|
|
|
|
|
try {
|
|
|
|
|
return value != null && !value.isEmpty() ? Double.parseDouble(value) : 0.0;
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void configureUpload() {
|
|
|
|
|
upload.setAcceptedFileTypes("image/jpeg", "image/png");
|
|
|
|
|
upload.setMaxFileSize(1024 * 1024);
|
|
|
|
@ -311,7 +239,9 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
buffer.getInputStream().transferTo(outputStream);
|
|
|
|
|
byte[] imageBytes = outputStream.toByteArray();
|
|
|
|
|
String base64Image = Base64.getEncoder().encodeToString(imageBytes);
|
|
|
|
|
|
|
|
|
|
getEntity().setProfileImage(base64Image);
|
|
|
|
|
|
|
|
|
|
profileImagePreview.setSrc("data:image/png;base64," + base64Image);
|
|
|
|
|
profileImagePreview.setMaxWidth("150px");
|
|
|
|
|
profileImagePreview.setMaxHeight("150px");
|
|
|
|
@ -336,9 +266,11 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
H2 headline = new H2("Ficha Empleado");
|
|
|
|
|
headline.getStyle().set("margin", "var(--lumo-space-m) 0 0 0")
|
|
|
|
|
.set("font-size", "1.5em").set("font-weight", "bold");
|
|
|
|
|
|
|
|
|
|
final Button cancelDialogButton = new Button("Close", e -> dialog.close());
|
|
|
|
|
final HorizontalLayout buttonLayout = new HorizontalLayout(cancelDialogButton);
|
|
|
|
|
buttonLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END);
|
|
|
|
|
|
|
|
|
|
final VerticalLayout dialogLayout = new VerticalLayout(headline, pdfViewer, buttonLayout);
|
|
|
|
|
dialogLayout.getStyle().set("height", "100%");
|
|
|
|
|
dialogLayout.getStyle().set("overflow", "hidden");
|
|
|
|
@ -348,6 +280,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
dialogLayout.setAlignItems(FlexComponent.Alignment.STRETCH);
|
|
|
|
|
dialogLayout.getStyle().set("width", "700px").set("max-width", "100%");
|
|
|
|
|
dialogLayout.getStyle().set("height", "800px").set("max-height", "100%");
|
|
|
|
|
|
|
|
|
|
dialog.add(dialogLayout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -366,16 +299,6 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
return comboBox;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ComboBox<Employee.ContractType> createContractTypeComboBox() {
|
|
|
|
|
ComboBox<Employee.ContractType> comboBox = new ComboBox<>("Tipo de Contrato");
|
|
|
|
|
comboBox.setItems(Employee.ContractType.values());
|
|
|
|
|
comboBox.setItemLabelGenerator(Employee.ContractType::name);
|
|
|
|
|
comboBox.setRequiredIndicatorVisible(true);
|
|
|
|
|
comboBox.setWidth("300px");
|
|
|
|
|
comboBox.setMinWidth("200px");
|
|
|
|
|
return comboBox;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private VerticalLayout createContentLayout() {
|
|
|
|
|
VerticalLayout contentLayout = new VerticalLayout();
|
|
|
|
|
contentLayout.setWidth("100%");
|
|
|
|
@ -393,7 +316,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
private EmailField createEmailField(final String label) {
|
|
|
|
|
EmailField emailField = new EmailField(label);
|
|
|
|
|
emailField.setWidthFull();
|
|
|
|
|
emailField.setMaxLength(50);
|
|
|
|
|
emailField.setMaxLength(30);
|
|
|
|
|
return emailField;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -449,10 +372,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
Employee employee = getEntity();
|
|
|
|
|
employee.setStatus(status.getValue());
|
|
|
|
|
employee.setAge(age.getValue());
|
|
|
|
|
employee.setSalaryBasic(salaryBasic.getValue());
|
|
|
|
|
employee.setBonoProfesional(bonoProfesional.getValue());
|
|
|
|
|
employee.setAntiguedad(antiguedad.getValue());
|
|
|
|
|
employee.setSalarytotal((salaryTotal.getValue()));
|
|
|
|
|
|
|
|
|
|
employeeService.createOrUpdate(employee);
|
|
|
|
|
Notification.show(NOTIFICATION_SAVE_SUCCESS);
|
|
|
|
|
getUI().ifPresent(ui -> ui.navigate(EmployeesListView.class));
|
|
|
|
@ -471,33 +391,28 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
public void setParameter(final BeforeEvent beforeEvent, final String action) {
|
|
|
|
|
final RouteParameters params = beforeEvent.getRouteParameters();
|
|
|
|
|
final String s = params.get("employeeId").orElse(null);
|
|
|
|
|
|
|
|
|
|
if ("new".equals(action)) {
|
|
|
|
|
setEntityWithEnabledSave(new Employee());
|
|
|
|
|
saveButton.setVisible(true);
|
|
|
|
|
editButton.setVisible(false);
|
|
|
|
|
setFieldsEditable();
|
|
|
|
|
upload.setVisible(true);
|
|
|
|
|
salaryTotal.setValue(String.valueOf(true));
|
|
|
|
|
} else {
|
|
|
|
|
UUID employeeId = UUID.fromString(s);
|
|
|
|
|
var employee = employeeService.getEmployee(employeeId);
|
|
|
|
|
setEntityWithEnabledSave(employee);
|
|
|
|
|
|
|
|
|
|
if ("edit".equals(action) && !s.isEmpty()) {
|
|
|
|
|
saveButton.setVisible(true);
|
|
|
|
|
editButton.setVisible(false);
|
|
|
|
|
status.setValue(employee.getStatus());
|
|
|
|
|
setFieldsEditable();
|
|
|
|
|
upload.setVisible(true);
|
|
|
|
|
displayProfileImage(employee);
|
|
|
|
|
salaryTotal.setValue(employee.getSalarytotal());
|
|
|
|
|
} else if ("view".equals(action) && !s.isEmpty()) {
|
|
|
|
|
setFieldsReadOnly();
|
|
|
|
|
saveButton.setVisible(false);
|
|
|
|
|
editButton.setVisible(true);
|
|
|
|
|
setFieldsReadOnly();
|
|
|
|
|
displayProfileImage(employee);
|
|
|
|
|
upload.setVisible(true);
|
|
|
|
|
salaryTotal.setValue(employee.getSalarytotal());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -508,6 +423,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
profileImagePreview.setVisible(true);
|
|
|
|
|
profileImagePreview.setMaxWidth("250px");
|
|
|
|
|
profileImagePreview.setMaxHeight("250px");
|
|
|
|
|
|
|
|
|
|
upload.setVisible(true);
|
|
|
|
|
} else {
|
|
|
|
|
profileImagePreview.setVisible(true);
|
|
|
|
@ -516,7 +432,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setFieldsReadOnly() {
|
|
|
|
|
username.setReadOnly(true);
|
|
|
|
|
username.setReadOnly(false);
|
|
|
|
|
firstName.setReadOnly(true);
|
|
|
|
|
lastName.setReadOnly(true);
|
|
|
|
|
status.setReadOnly(true);
|
|
|
|
@ -528,8 +444,6 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
numberOfChildren.setReadOnly(true);
|
|
|
|
|
phoneNumber.setReadOnly(true);
|
|
|
|
|
personalEmail.setReadOnly(true);
|
|
|
|
|
phoneNumberProfesional.setReadOnly(true);
|
|
|
|
|
profesionalEmail.setReadOnly(true);
|
|
|
|
|
position.setReadOnly(true);
|
|
|
|
|
team.setReadOnly(true);
|
|
|
|
|
emergencyCName.setReadOnly(true);
|
|
|
|
@ -555,26 +469,21 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
certification4.setReadOnly(true);
|
|
|
|
|
recognition.setReadOnly(true);
|
|
|
|
|
achievements.setReadOnly(true);
|
|
|
|
|
language1.setReadOnly(true);
|
|
|
|
|
language1Level.setReadOnly(true);
|
|
|
|
|
language2.setReadOnly(true);
|
|
|
|
|
language2Level.setReadOnly(true);
|
|
|
|
|
language.setReadOnly(true);
|
|
|
|
|
languageLevel.setReadOnly(true);
|
|
|
|
|
cod.setReadOnly(true);
|
|
|
|
|
leadManager.setReadOnly(true);
|
|
|
|
|
project.setReadOnly(true);
|
|
|
|
|
dateOfEntry.setReadOnly(true);
|
|
|
|
|
dateOfExit.setReadOnly(true);
|
|
|
|
|
contractType.setReadOnly(true);
|
|
|
|
|
seniority.setReadOnly(true);
|
|
|
|
|
salaryTotal.setReadOnly(true);
|
|
|
|
|
salaryBasic.setReadOnly(true);
|
|
|
|
|
bonoProfesional.setReadOnly(true);
|
|
|
|
|
antiguedad.setReadOnly(true);
|
|
|
|
|
salary.setReadOnly(true);
|
|
|
|
|
bankName.setReadOnly(true);
|
|
|
|
|
accountNumber.setReadOnly(true);
|
|
|
|
|
gpss.setReadOnly(true);
|
|
|
|
|
sss.setReadOnly(true);
|
|
|
|
|
beneficiarie1.setReadOnly(true);
|
|
|
|
|
beneficiarie2.setReadOnly(true);
|
|
|
|
|
beneficiaries.setReadOnly(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setFieldsEditable() {
|
|
|
|
@ -590,8 +499,6 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
numberOfChildren.setReadOnly(false);
|
|
|
|
|
phoneNumber.setReadOnly(false);
|
|
|
|
|
personalEmail.setReadOnly(false);
|
|
|
|
|
phoneNumberProfesional.setReadOnly(false);
|
|
|
|
|
profesionalEmail.setReadOnly(false);
|
|
|
|
|
position.setReadOnly(false);
|
|
|
|
|
team.setReadOnly(false);
|
|
|
|
|
emergencyCName.setReadOnly(false);
|
|
|
|
@ -617,26 +524,21 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
certification4.setReadOnly(false);
|
|
|
|
|
recognition.setReadOnly(false);
|
|
|
|
|
achievements.setReadOnly(false);
|
|
|
|
|
language1.setReadOnly(false);
|
|
|
|
|
language1Level.setReadOnly(false);
|
|
|
|
|
language2.setReadOnly(false);
|
|
|
|
|
language2Level.setReadOnly(false);
|
|
|
|
|
language.setReadOnly(false);
|
|
|
|
|
languageLevel.setReadOnly(false);
|
|
|
|
|
cod.setReadOnly(false);
|
|
|
|
|
leadManager.setReadOnly(false);
|
|
|
|
|
project.setReadOnly(false);
|
|
|
|
|
dateOfEntry.setReadOnly(false);
|
|
|
|
|
dateOfExit.setReadOnly(false);
|
|
|
|
|
contractType.setReadOnly(false);
|
|
|
|
|
seniority.setReadOnly(false);
|
|
|
|
|
salaryTotal.setReadOnly(false);
|
|
|
|
|
salaryBasic.setReadOnly(false);
|
|
|
|
|
bonoProfesional.setReadOnly(false);
|
|
|
|
|
antiguedad.setReadOnly(false);
|
|
|
|
|
salary.setReadOnly(false);
|
|
|
|
|
bankName.setReadOnly(false);
|
|
|
|
|
accountNumber.setReadOnly(false);
|
|
|
|
|
gpss.setReadOnly(false);
|
|
|
|
|
sss.setReadOnly(false);
|
|
|
|
|
beneficiarie1.setReadOnly(false);
|
|
|
|
|
beneficiarie2.setReadOnly(false);
|
|
|
|
|
beneficiaries.setReadOnly(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -651,19 +553,18 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
|
|
|
|
|
birthday, age,
|
|
|
|
|
birthCity, residenceAddress, localAddress,
|
|
|
|
|
maritalStatus, ci, issuedIn, numberOfChildren,
|
|
|
|
|
phoneNumber, personalEmail, phoneNumberProfesional, profesionalEmail,
|
|
|
|
|
phoneNumber, personalEmail,
|
|
|
|
|
contEmerg, emergencyCName, emergencyCAddress, emergencyCPhone, emergencyCEmail,
|
|
|
|
|
infProf,
|
|
|
|
|
titulos, pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
|
|
|
|
|
certif, certification1, certification2, certification3, certification4,
|
|
|
|
|
logros, recognition, achievements,
|
|
|
|
|
idioma, language1, language1Level, language2, language2Level,
|
|
|
|
|
idioma, language, languageLevel,
|
|
|
|
|
infoAdm,
|
|
|
|
|
cod, position, team, leadManager,
|
|
|
|
|
infoCont, dateOfEntry, dateOfExit, contractType, seniority,
|
|
|
|
|
salaryBasic, bonoProfesional, antiguedad, salaryTotal,
|
|
|
|
|
cod, position, team, leadManager, project,
|
|
|
|
|
infoCont, dateOfEntry, dateOfExit, contractType, seniority, salary,
|
|
|
|
|
datBanc, bankName, accountNumber,
|
|
|
|
|
datGest, gpss, sss, beneficiarie1, beneficiarie2,
|
|
|
|
|
datGest, gpss, sss, beneficiaries,
|
|
|
|
|
saveButton, editButton, reportButton, dialog
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|