Corregir nombre de bono por Antiguedad

This commit is contained in:
Melina Gutierrez 2024-11-25 16:32:02 -04:00
parent c9f2e0900a
commit 9c1921df9a
2 changed files with 37 additions and 3 deletions

View File

@ -102,6 +102,7 @@ public class Employee extends BaseEntity implements UserDetails {
private String bankName; private String bankName;
@Pattern(regexp = "^[0-9]+$", message = "El número de cuenta debe contener solo números") @Pattern(regexp = "^[0-9]+$", message = "El número de cuenta debe contener solo números")
private String accountNumber; private String accountNumber;
private String customContractType;
private String gpss; private String gpss;
private String sss; private String sss;
@ -114,6 +115,10 @@ public class Employee extends BaseEntity implements UserDetails {
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private Status status; private Status status;
public void setCustomContractType(String customContractType) {
this.customContractType = customContractType;
}
@Override @Override
public Collection<? extends GrantedAuthority> getAuthorities() { public Collection<? extends GrantedAuthority> getAuthorities() {
return Lists.newArrayList(); return Lists.newArrayList();

View File

@ -106,10 +106,11 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
private final VDatePicker dateOfEntry = new VDatePicker("Fecha de Ingreso"); private final VDatePicker dateOfEntry = new VDatePicker("Fecha de Ingreso");
private final VDatePicker dateOfExit = new VDatePicker("Fecha de Retiro"); private final VDatePicker dateOfExit = new VDatePicker("Fecha de Retiro");
private final ComboBox<Employee.ContractType> contractType = createContractTypeComboBox(); private final ComboBox<Employee.ContractType> contractType = createContractTypeComboBox();
private final TextField customContractType = createCustomContractTypeField();
private final TextField seniority = createTextField("Antiguedad", 30, false); private final TextField seniority = createTextField("Antiguedad", 30, false);
private final TextField salaryTotal = createTextField("Salario Total", 10, false); private final TextField salaryTotal = createTextField("Salario Total", 10, false);
private final TextField salaryBasic = createTextField("Salario Basico", 10, false); private final TextField salaryBasic = createTextField("Salario Basico", 10, false);
private final TextField antiguedad = createTextField("Descuento por Antiguedad", 10, false); private final TextField antiguedad = createTextField("Bono de Antiguedad", 10, false);
private final TextField bonoProfesional = createTextField("Bono Profesional", 30, false); private final TextField bonoProfesional = createTextField("Bono Profesional", 30, false);
private final TextField bankName = createTextField("Banco", 30, false); private final TextField bankName = createTextField("Banco", 30, false);
private final TextField accountNumber = createTextField("Nro. de Cuenta", 30, false); private final TextField accountNumber = createTextField("Nro. de Cuenta", 30, false);
@ -383,10 +384,30 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
comboBox.setItemLabelGenerator(Employee.ContractType::name); comboBox.setItemLabelGenerator(Employee.ContractType::name);
comboBox.setRequiredIndicatorVisible(true); comboBox.setRequiredIndicatorVisible(true);
comboBox.setWidth("300px"); comboBox.setWidth("300px");
comboBox.setMinWidth("200px"); comboBox.addValueChangeListener(event -> handleContractTypeChange(event.getValue()));
return comboBox; return comboBox;
} }
private TextField createCustomContractTypeField() {
TextField textField = new TextField("Especificar Tipo de Contrato");
textField.setPlaceholder("Ingrese el tipo de contrato...");
textField.setVisible(false);
textField.setWidth("300px");
return textField;
}
private void handleContractTypeChange(Employee.ContractType selectedType) {
if (selectedType == Employee.ContractType.OTROS) {
customContractType.setVisible(true);
customContractType.setRequired(true);
} else {
customContractType.setVisible(false);
customContractType.clear();
customContractType.setRequired(false);
}
}
private VerticalLayout createContentLayout() { private VerticalLayout createContentLayout() {
VerticalLayout contentLayout = new VerticalLayout(); VerticalLayout contentLayout = new VerticalLayout();
contentLayout.setWidth("100%"); contentLayout.setWidth("100%");
@ -464,6 +485,12 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
employee.setBonoProfesional(bonoProfesional.getValue()); employee.setBonoProfesional(bonoProfesional.getValue());
employee.setAntiguedad(antiguedad.getValue()); employee.setAntiguedad(antiguedad.getValue());
employee.setSalarytotal((salaryTotal.getValue())); employee.setSalarytotal((salaryTotal.getValue()));
employee.setContractType(contractType.getValue());
if (contractType.getValue() == Employee.ContractType.OTROS) {
employee.setCustomContractType(customContractType.getValue());
} else {
employee.setCustomContractType(null);
}
employeeService.createOrUpdate(employee); employeeService.createOrUpdate(employee);
Notification.show(NOTIFICATION_SAVE_SUCCESS); Notification.show(NOTIFICATION_SAVE_SUCCESS);
getUI().ifPresent(ui -> ui.navigate(EmployeesListView.class)); getUI().ifPresent(ui -> ui.navigate(EmployeesListView.class));
@ -575,6 +602,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
dateOfEntry.setReadOnly(true); dateOfEntry.setReadOnly(true);
dateOfExit.setReadOnly(true); dateOfExit.setReadOnly(true);
contractType.setReadOnly(true); contractType.setReadOnly(true);
customContractType.setReadOnly(true);
seniority.setReadOnly(true); seniority.setReadOnly(true);
salaryTotal.setReadOnly(true); salaryTotal.setReadOnly(true);
salaryBasic.setReadOnly(true); salaryBasic.setReadOnly(true);
@ -637,6 +665,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
dateOfEntry.setReadOnly(false); dateOfEntry.setReadOnly(false);
dateOfExit.setReadOnly(false); dateOfExit.setReadOnly(false);
contractType.setReadOnly(false); contractType.setReadOnly(false);
customContractType.setReadOnly(false);
seniority.setReadOnly(false); seniority.setReadOnly(false);
salaryTotal.setReadOnly(false); salaryTotal.setReadOnly(false);
salaryBasic.setReadOnly(false); salaryBasic.setReadOnly(false);
@ -671,7 +700,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
idioma, language1, language1Level, language2, language2Level, idioma, language1, language1Level, language2, language2Level,
infoAdm, infoAdm,
cod, position, team, leadManager, cod, position, team, leadManager,
infoCont, dateOfEntry, dateOfExit, contractType, seniority, infoCont, dateOfEntry, dateOfExit, seniority, contractType, customContractType,
salaryBasic, bonoProfesional, antiguedad, salaryTotal, salaryBasic, bonoProfesional, antiguedad, salaryTotal,
datBanc, bankName, accountNumber, datBanc, bankName, accountNumber,
datGest, gpss, sss, beneficiarie1, beneficiarie2, datGest, gpss, sss, beneficiarie1, beneficiarie2,