merged conflicts

This commit is contained in:
alex 2024-09-26 21:45:44 -04:00
parent a7d1c08f90
commit b4c27f8a9b
2 changed files with 185 additions and 4 deletions

View File

@ -22,6 +22,7 @@
private String lastName;
private LocalDate birthday;
private String birthCity;
private String age;
@Enumerated(EnumType.STRING)
private MaritalStatus maritalStatus;
private String residenceAddress;
@ -33,6 +34,51 @@
private String emergencyCAddress;
private String emergencyCPhone;
private String emergencyCEmail;
private String numberOfChildren;
private String departmentAndProvinceResidence;
private String gender;
private String ci;
private String issuedIn;
private String pTitle1;
private String pTitle2;
private String pTitle3;
private String pStudy1;
private String pStudy2;
private String pStudy3;
private String certification1;
private String certification2;
private String certification3;
private String certification4;
private String recognition;
private String achievements;
private String language;
private String languageLevel;
private String cod;
private String leadManager;
private String project;
private LocalDate dateOfEntry;
private LocalDate dateOfExit;
private String contractType;
private Integer seniority;
private Double salary;
private String bankName;
private String accountNumber;
private String gpss;
private String sss;
private String beneficiaries;
@Column(columnDefinition = "TEXT")
private String profileImage;
@Enumerated(EnumType.STRING)

View File

@ -6,6 +6,7 @@ import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.html.Image;
@ -75,6 +76,50 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
private final H3 ss = new H3("Datos de Contacto de Emergencia");
private final H3 si = new H3("Foto del Empleado");
private final TextField age = createTextField("Edad", 3, false);
private final TextField gender = createTextField("Genero:", 10, false);
private final TextField numberOfChildren = createTextField("Number of Children", 3, false);
private final TextField ci = createTextField("CI", 30, false);
private final TextField issuedIn = createTextField("Issued In", 30, false);
private final TextField pTitle1 = createTextField("Professional Title 1", 30, false);
private final TextField pTitle2 = createTextField("Professional Title 2", 30, false);
private final TextField pTitle3 = createTextField("Professional Title 3", 30, false);
private final TextField pStudy1 = createTextField("Study 1", 30, false);
private final TextField pStudy2 = createTextField("Study 2", 30, false);
private final TextField pStudy3 = createTextField("Study 3", 30, false);
private final TextField certification1 = createTextField("Certification 1", 30, false);
private final TextField certification2 = createTextField("Certification 2", 30, false);
private final TextField certification3 = createTextField("Certification 3", 30, false);
private final TextField certification4 = createTextField("Certification 4", 30, false);
private final TextField recognition = createTextField("Recognition", 30, false);
private final TextField achievements = createTextField("Achievements", 30, false);
private final TextField language = createTextField("Language", 30, false);
private final TextField languageLevel = createTextField("Language Level", 30, false);
private final TextField cod = createTextField("Code", 30, false);
private final TextField leadManager = createTextField("Lead Manager", 30, false);
private final TextField project = createTextField("Project", 30, false);
private final DatePicker dateOfEntry = new DatePicker("Date of Entry");
private final DatePicker dateOfExit = new DatePicker("Date of Exit");
private final TextField contractType = createTextField("Contract Type", 30, false);
private final TextField seniority = createTextField("Seniority", 30, false);
private final TextField salary = createTextField("Salary", 30, false);
private final TextField bankName = createTextField("Bank Name", 30, false);
private final TextField accountNumber = createTextField("Account Number", 30, false);
private final TextField gpss = createTextField("GPSS", 30, false);
private final TextField sss = createTextField("SSS", 30, false);
private final TextField beneficiaries = createTextField("Beneficiaries", 30, false);
public EmployeeView(final EmployeeService employeeService) {
super(Employee.class);
this.employeeService = employeeService;
@ -92,6 +137,18 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
configureUpload();
saveButton.setVisible(true);
editButton.setVisible(true);
birthday.addValueChangeListener(event -> calculateAge());
}
private void calculateAge() {
if (birthday.getValue() != null) {
int currentYear = java.time.LocalDate.now().getYear();
int birthYear = birthday.getValue().getYear();
int ages = currentYear - birthYear;
age.setValue(String.valueOf(ages));
}
}
private void configureUpload() {
@ -132,16 +189,23 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
lastName,
status,
birthday,
age,
birthCity,
maritalStatus,
numberOfChildren,
residenceAddress,
phoneNumber,
personalEmail,
position,
team);
team, gender, status, ci, issuedIn);
contentLayout2.add(
ss, emergencyCName, emergencyCAddress,
emergencyCPhone, emergencyCEmail, si, upload,
emergencyCPhone, emergencyCEmail, pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
certification1, certification2, certification3, certification4,
recognition, achievements, language, languageLevel,
cod, leadManager, project, dateOfEntry, dateOfExit,
contractType, seniority, salary, bankName, accountNumber,
gpss, sss, beneficiaries, si, upload,
profileImagePreview, saveButton, editButton);
mainLayout.add(contentLayout1, contentLayout2);
@ -277,6 +341,38 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
emergencyCEmail.setReadOnly(true);
upload.setVisible(true);
profileImagePreview.setVisible(true);
age.setVisible(true);
gender.setVisible(true);
status.setVisible(true);
ci.setVisible(true);
issuedIn.setVisible(true);
pTitle1.setVisible(true);
pTitle2.setVisible(true);
pTitle3.setVisible(true);
pStudy1.setVisible(true);
pStudy2.setVisible(true);
pStudy3.setVisible(true);
certification1.setVisible(true);
certification2.setVisible(true);
certification3.setVisible(true);
certification4.setVisible(true);
recognition.setVisible(true);
achievements.setVisible(true);
language.setVisible(true);
languageLevel.setVisible(true);
cod.setVisible(true);
leadManager.setVisible(true);
project.setVisible(true);
dateOfEntry.setVisible(true);
dateOfExit.setVisible(true);
contractType.setVisible(true);
seniority.setVisible(true);
salary.setVisible(true);
bankName.setVisible(true);
accountNumber.setVisible(true);
gpss.setVisible(true);
sss.setVisible(true);
beneficiaries.setVisible(true);
}
private void setFieldsEditable() {
@ -296,14 +392,53 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
emergencyCPhone.setReadOnly(false);
emergencyCEmail.setReadOnly(false);
upload.setVisible(true);
age.setVisible(false);
gender.setVisible(false);
status.setVisible(false);
ci.setVisible(false);
issuedIn.setVisible(false);
pTitle1.setVisible(false);
pTitle2.setVisible(false);
pTitle3.setVisible(false);
pStudy1.setVisible(false);
pStudy2.setVisible(false);
pStudy3.setVisible(false);
certification1.setVisible(false);
certification2.setVisible(false);
certification3.setVisible(false);
certification4.setVisible(false);
recognition.setVisible(false);
achievements.setVisible(false);
language.setVisible(false);
languageLevel.setVisible(false);
cod.setVisible(false);
leadManager.setVisible(false);
project.setVisible(false);
dateOfEntry.setVisible(false);
dateOfExit.setVisible(false);
contractType.setVisible(false);
seniority.setVisible(false);
salary.setVisible(false);
bankName.setVisible(false);
accountNumber.setVisible(false);
gpss.setVisible(false);
sss.setVisible(false);
beneficiaries.setVisible(false);
}
@Override
protected List<Component> getFormComponents() {
return List.of(
mt, fs, username, firstName, lastName, status, birthday, birthCity, maritalStatus,
mt, fs, username, firstName, lastName, status, birthday, age, birthCity, maritalStatus,
residenceAddress, phoneNumber, personalEmail, position, team, ss, emergencyCName,
emergencyCAddress, emergencyCPhone, emergencyCEmail, si, upload, profileImagePreview,
emergencyCAddress, emergencyCPhone, emergencyCEmail, age,
gender, status, ci, issuedIn,
pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
certification1, certification2, certification3, certification4,
recognition, achievements, language, languageLevel,
cod, leadManager, project, dateOfEntry, dateOfExit,
contractType, seniority, salary, bankName, accountNumber,
gpss, sss, beneficiaries, si, upload, profileImagePreview,
saveButton, editButton
);
}